pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Replace typcache.c's buggy in_progress_list.
3+ messages / 1 participants
[nested] [flat]

* pgsql: Replace typcache.c's buggy in_progress_list.
@ 2026-11-09 14:21  Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
master

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

Modified Files
--------------
src/backend/utils/cache/typcache.c | 274 ++++++++++---------------------------
1 file changed, 73 insertions(+), 201 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Replace typcache.c's buggy in_progress_list.
@ 2026-11-09 14:21  Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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_19_STABLE

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

Modified Files
--------------
src/backend/utils/cache/typcache.c | 263 +++++++++++--------------------------
1 file changed, 74 insertions(+), 189 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Replace typcache.c's buggy in_progress_list.
@ 2026-11-09 14:21  Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2026-11-09 14:21 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-09 14:21 pgsql: Replace typcache.c's buggy in_progress_list. Noah Misch <noah@leadboat.com>
2026-11-09 14:21 pgsql: Replace typcache.c's buggy in_progress_list. Noah Misch <noah@leadboat.com>
2026-11-09 14:21 pgsql: Replace typcache.c's buggy in_progress_list. Noah Misch <noah@leadboat.com>

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