pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Reorder superuser check in pg_log_backend_memory_contexts()
Date: Tue, 08 Jun 2021 00:05:32 +0000
Message-ID: <E1lqPFM-0005V3-Sa@gemulon.postgresql.org> (raw)

Reorder superuser check in pg_log_backend_memory_contexts()

The use of this function is limited to superusers and the code includes
a hardcoded check for that.  However, the code would look for the PGPROC
entry to signal for the memory dump before checking if the user is a
superuser or not, which does not make sense if we know that an error
will be returned.  Note that the code would let one know if a process
was a PostgreSQL process or not even for non-authorized users, which is
not the case now, but this avoids taking ProcArrayLock that will most
likely finish by being unnecessary.

Thanks to Julien Rouhaud and Tom Lane for the discussion.

Discussion: https://postgr.es/m/YLxw1uVGIAP5uMPl@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4e47b02834827fa700627290fae02f89a450368c

Modified Files
--------------
src/backend/utils/adt/mcxtfuncs.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)



Message-ID: <E1lqPFM-0005V3-Sa@gemulon.postgresql.org>
Permalink:  ../E1lqPFM-0005V3-Sa@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lqPFM-0005V3-Sa@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: michael@paquier.xyz
  Subject: Re: pgsql: Reorder superuser check in pg_log_backend_memory_contexts()
  In-Reply-To: <E1lqPFM-0005V3-Sa@gemulon.postgresql.org>
  References: <E1lqPFM-0005V3-Sa@gemulon.postgresql.org>

* 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