pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Geoghegan <pg@bowt.ie>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add hardening to catch invalid TIDs in indexes.
Date: Fri, 05 Nov 2021 02:54:25 +0000
Message-ID: <E1mipN3-0003xz-TP@gemulon.postgresql.org> (raw)

Add hardening to catch invalid TIDs in indexes.

Add hardening to the heapam index tuple deletion path to catch TIDs in
index pages that point to a heap item that index tuples should never
point to.  The corruption we're trying to catch here is particularly
tricky to detect, since it typically involves "extra" (corrupt) index
tuples, as opposed to the absence of required index tuples in the index.

For example, a heap TID from an index page that turns out to point to an
LP_UNUSED item in the heap page has a good chance of being caught by one
of the new checks.  There is a decent chance that the recently fixed
parallel VACUUM bug (see commit 9bacec15) would have been caught had
that particular check been in place for Postgres 14.  No backpatch of
this extra hardening for now, though.

Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/CAH2-Wzk-4_raTzawWGaiqNvkpwDXxv3y1AQhQyUeHfkU=tFCeA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e7428a99a13f973549aab30c57ec8380ddda1869

Modified Files
--------------
src/backend/access/heap/heapam.c      | 65 +++++++++++++++++++++++++++++++++++
src/backend/access/index/genam.c      |  7 ++--
src/backend/access/nbtree/nbtdedup.c  |  2 ++
src/backend/access/nbtree/nbtinsert.c |  2 ++
src/include/access/tableam.h          |  2 ++
5 files changed, 76 insertions(+), 2 deletions(-)



Message-ID: <E1mipN3-0003xz-TP@gemulon.postgresql.org>
Permalink:  ../E1mipN3-0003xz-TP@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1mipN3-0003xz-TP@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: pg@bowt.ie
  Subject: Re: pgsql: Add hardening to catch invalid TIDs in indexes.
  In-Reply-To: <E1mipN3-0003xz-TP@gemulon.postgresql.org>
  References: <E1mipN3-0003xz-TP@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox