Re: Use-after-free in 12- EventTriggerAlterTableEnd - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Use-after-free in 12- EventTriggerAlterTableEnd
Date
Msg-id 1093133.1603826467@sss.pgh.pa.us
Whole thread Raw
In response to Use-after-free in 12- EventTriggerAlterTableEnd  (Arseny Sher <a.sher@postgrespro.ru>)
List pgsql-hackers
Arseny Sher <a.sher@postgrespro.ru> writes:
> Valgrind on our internal buildfarm complained about use-after-free
> during currentEventTriggerState->commandList manipulations, e.g. lappend
> in EventTriggerCollectSimpleCommand. I've discovered that the source of
> problem is EventTriggerAlterTableEnd not bothering to switch into its
> own context before appending to the list. ced138e8cba fixed this in
> master and 13 but wasn't backpatched further, so I see the problem in
> 12-.

Yeah, that clearly should have been back-patched --- the fact that it
accidentally didn't fail in the most common case wasn't a good reason
for leaving the bug in place.  I'm not excited about the test case
ced138e8cba added though, so I think your proposed patch is fine.
Will push shortly.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Anastasia Lubennikova
Date:
Subject: Re: COPY FREEZE and setting PD_ALL_VISIBLE/visibility map bits
Next
From: John Naylor
Date:
Subject: cutting down the TODO list thread