pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Arseny Sher <a.sher@postgrespro.ru>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Subject: Re: Use-after-free in 12- EventTriggerAlterTableEnd
Date: Tue, 27 Oct 2020 15:21:07 -0400
Message-ID: <1093133.1603826467@sss.pgh.pa.us> (raw)
In-Reply-To: <877drcyprb.fsf@ars-thinkpad>
References: <877drcyprb.fsf@ars-thinkpad>

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





view thread (2+ messages)

Message-ID: <1093133.1603826467@sss.pgh.pa.us>
Permalink:  ../1093133.1603826467@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1093133.1603826467@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, a.sher@postgrespro.ru, alvherre@alvh.no-ip.org
  Subject: Re: Use-after-free in 12- EventTriggerAlterTableEnd
  In-Reply-To: <1093133.1603826467@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox