Re: BUG #17462: Invalid memory access in heapam_tuple_lock
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: anisimow.d@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2022-04-12T21:40:05Z
Lists: pgsql-bugs
Attachments
- heap_fetch-fix-HEAD.patch (text/x-diff) patch
- heap_fetch-fix-v14.patch (text/x-diff) patch v14
I wrote: > As written here, even though there's no obvious API break, there is > a subtle change: heap_fetch will now return tuple->t_data = NULL after > a snapshot failure. I'm of two minds whether to back-patch that part > (not doing so would require more changes in heapam_tuple_lock, though). After further thought I think we shouldn't back-patch that part: it could easily break code that's functionally correct today, and there isn't any case that it makes better without caller-code changes. (I'm not sure what made me think it'd affect heapam_tuple_lock; that function only cares about the behavior with keep_buf = true.) Hence, I end up with two different patches for HEAD and the back branches. In HEAD, we explicitly break heap_fetch compatibility by adding a new argument, and we can make the commit message note the more subtle change too. In the back branches, the behavior of heap_fetch is unchanged and heapam_tuple_lock has to use heap_fetch_extended. regards, tom lane
Commits
-
Prevent access to no-longer-pinned buffer in heapam_tuple_lock().
- 7b7ed046cb2a 15.0 landed
- e0ed20d0b66e 12.11 landed
- c590e514a90d 14.3 landed
- 44096c31eaf0 13.7 landed
-
Add Valgrind buffer access instrumentation.
- 1e0dfd166b3f 14.0 cited
-
tableam: Add tuple_{insert, delete, update, lock} and use.
- 5db6df0c0117 12.0 cited