Re: BUG #17462: Invalid memory access in heapam_tuple_lock - Mailing list pgsql-bugs

From Andres Freund
Subject Re: BUG #17462: Invalid memory access in heapam_tuple_lock
Date
Msg-id 20220411194051.sovwssdawxoh4m5h@alap3.anarazel.de
Whole thread Raw
In response to Re: BUG #17462: Invalid memory access in heapam_tuple_lock  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #17462: Invalid memory access in heapam_tuple_lock
List pgsql-bugs
Hi,

On 2022-04-11 15:25:12 -0400, Tom Lane wrote:
> 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.

Right. There's enough space on x86-64, just not contiuous. But not on 32bit
x86, so even if we were willing to live with the ugliness of splitting
ItemPointerData across fields temporarily (which I don't think we would)...

I guess we could put members of SnapshotData into a union with ItemPointerData
that aren't used by InitDirtySnapshot()/HeapTupleSatisfiesDirty().

E.g. ph_node - which fairly fundamentally won't be used by dirty snapshots,
and seems unlikely to be used by any extensions? And even if, it'd cause a
compile-time breakage for such extensions, not a silent ABI breakage...

Greetings,

Andres Freund



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #17462: Invalid memory access in heapam_tuple_lock
Next
From: Tom Lane
Date:
Subject: Re: BUG #17462: Invalid memory access in heapam_tuple_lock