pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Noah Misch <noah@leadboat.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Replace typcache.c's buggy in_progress_list.
Date: Mon, 09 Nov 2026 14:21:59 +0000
Message-ID: <E1xQQFz-000000003eH-1CJH@gemulon.postgresql.org> (raw)

Replace typcache.c's buggy in_progress_list.

Commit b85a9d046efdd27775cbe7db9e92aad96aab4ada added this mechanism
as a response to bugs reported when the same feature was previously
committed as c14d4acb81348a34497b53a19dce2924cc4f6551. Unfortunately,
it turns out to have multiple bugs. AtEOSubXact_TypeCache() cleared
the entire list, instead of only the entries added at or below
the current subtransaction level. Both AtEOXact_TypeCache() and
AtEOSubXact_TypeCache() perform allocations in the abort path,
which risks a second error before we've finished recovering from
the first. Also, because in_progress_list was used to defer adding
entries to RelIdToTypeIdCacheHash, it introduced a risk of missing
invalidations that occurred after lookup_type_cache() performed
the pg_type lookup and before the RelIdToTypeIdCacheHash update.
Some of these problems are security vulnerabilities.

Removing in_progress_list fixes all of these problems, but risks
reintroducing the problems that in_progress_list was meant to fix.
Specifically, we have to make sure that an invalidation processed
while lookup_type_cache() is executing can't remove the associated
RelIdToTypeIdCacheHash entry before the TypeCacheEntry is even
returned to the caller. This commit solves that problem by never
removing entries from that hash table under any circumstances.
Instead, we now tolerate stale hash table entries, and check
whether any given entry is still valid before relying on it. See
the comments for further details.

Reported-by: Peter Geoghegan <pg@bowt.ie>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Security: CVE-2026-120144
Backpatch-through: 18

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2950cc7897a2c10f080f308dbef3b80665c6fd71
Author: Robert Haas <rhaas@postgresql.org>

Modified Files
--------------
src/backend/utils/cache/typcache.c | 249 ++++++++++---------------------------
1 file changed, 69 insertions(+), 180 deletions(-)



view thread (3+ messages)

Message-ID: <E1xQQFz-000000003eH-1CJH@gemulon.postgresql.org>
Permalink:  ../E1xQQFz-000000003eH-1CJH@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xQQFz-000000003eH-1CJH@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: noah@leadboat.com
  Subject: Re: pgsql: Replace typcache.c's buggy in_progress_list.
  In-Reply-To: <E1xQQFz-000000003eH-1CJH@gemulon.postgresql.org>
  References: <E1xQQFz-000000003eH-1CJH@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