pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: bianpan2016@163.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15540: Use after release in ExecuteTruncateGuts
Date: Fri, 07 Dec 2018 11:09:05 -0500
Message-ID: <31125.1544198945@sss.pgh.pa.us> (raw)
In-Reply-To: <15540-01078812338195c0@postgresql.org>
References: <15540-01078812338195c0@postgresql.org>

=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> writes:
> The function ExecuteTruncateGuts drops the reference to rel via
> relation_close when toast_relid is valid. However, after that, rel is passed
> to pgstat_count_truncate. This may result in a use-after-release bug.

... and, even more to the point, the truncation stats count is incorrectly
applied to the toast table not its parent.

> Maybe,
> rel should be re-declared on the branch that toast_relid is valid.

Yeah, seems like the right way.  Will fix.

Are you using a static analyzer to find these?  I'm curious how
you noticed them.

			regards, tom lane




view thread (5+ messages)  latest in thread

Message-ID: <31125.1544198945@sss.pgh.pa.us>
Permalink:  ../31125.1544198945@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/31125.1544198945@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-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, bianpan2016@163.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #15540: Use after release in ExecuteTruncateGuts
  In-Reply-To: <31125.1544198945@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