pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrey Lepikhov <a.lepikhov@postgrespro.ru>
Cc: PostgreSQL-Dev <pgsql-hackers@postgresql.org>
Subject: Re: Insecure initialization of required_relids field
Date: Mon, 15 Jul 2019 09:48:27 -0400
Message-ID: <29956.1563198507@sss.pgh.pa.us> (raw)
In-Reply-To: <5c21029d-81a2-c999-6744-6a898fcc9a19@postgrespro.ru>
References: <5c21029d-81a2-c999-6744-6a898fcc9a19@postgrespro.ru>

Andrey Lepikhov <a.lepikhov@postgrespro.ru> writes:
> commit a31ad27fc5d introduced required_relids field. By default, it 
> links to the clause_relids.
> It works good while we do not modify clause_relids or required_relids.
> But in the case of modification such initialization demands us to 
> remember, that this field is shared. And we need to do bms_copy() before 
> making any changes (see [1] for example).
> Also, we make some changes of the RestrictInfo fields (see patch [2]) 
> during removing of unneeded self joins.
> I propose to do more secure initialization way of required_relids (see 
> patch in attachment).

This seems fairly expensive (which is why it wasn't done like that
to start with) and you've pointed to no specific bug that it fixes.
Seeing that (a) the original commit is 14 years old, and (b) changing
either of these fields after-the-fact is at most a very niche usage,
I don't think we really have a problem here.

			regards, tom lane





view thread (3+ messages)  latest in thread

Message-ID: <29956.1563198507@sss.pgh.pa.us>
Permalink:  ../29956.1563198507@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29956.1563198507@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, a.lepikhov@postgrespro.ru
  Subject: Re: Insecure initialization of required_relids field
  In-Reply-To: <29956.1563198507@sss.pgh.pa.us>
  References: <5c21029d-81a2-c999-6744-6a898fcc9a19@postgrespro.ru> <29956.1563198507@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