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-11T19:25:12Z
Lists: pgsql-bugs
Andres Freund <andres@anarazel.de> writes:
> Another approach is to extend the SatisfiesDirty approach and store the tid of
> the next tuple version in addition the xmin/xmax we already store. And have
> heap_fetch() always set t_data to NULL if the snapshot check fails.

That seems like a fairly clean idea, although I think we can't use it
in the back branches without an ABI break.  We're not going to find a
TID's worth of padding space in struct SnapshotData.

			regards, tom lane



Commits

  1. Prevent access to no-longer-pinned buffer in heapam_tuple_lock().

  2. Add Valgrind buffer access instrumentation.

  3. tableam: Add tuple_{insert, delete, update, lock} and use.