]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix reuse-after-free hazard in dead_items_reset
authorJohn Naylor <john.naylor@postgresql.org>
Fri, 3 Oct 2025 09:06:03 +0000 (16:06 +0700)
committerJohn Naylor <john.naylor@postgresql.org>
Fri, 3 Oct 2025 09:07:34 +0000 (16:07 +0700)
commit3549ffb6afaf045d715be6ca42814f0a08ad2af9
treea82b6d2fd9200dabb0ee228930b46c8fa21a3639
parentde6de069d9c6b432a5dfd98b0784ed7f60a793ce
Fix reuse-after-free hazard in dead_items_reset

In similar vein to commit ccc8194e427, a reset instance of a shared
memory TID store happened to occupy the same private memory as the old
one for the entry point, since the chunk freed after the last round
of index vacuuming was put on the context's freelist. The failure
to update the vacrel->dead_items pointer was evident by nudging the
system to allocate memory in a different area. This was not discovered
at the time of the earlier commit since our regression tests didn't
cover multiple index passes with parallel vacuum.

Backpatch to v17, when TidStore came in.

Author: Kevin Oommen Anish <kevin.o@zohocorp.com>
Reviewed-by: Richard Guo <guofenglinux@gmail.com>
Tested-by: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/199a07cbdfc.7a1c4aac25838.1675074408277594551%40zohocorp.com
Backpatch-through: 17
src/backend/access/heap/vacuumlazy.c