| From: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
|---|---|
| To: | Michael Paquier <michael(at)paquier(dot)xyz> |
| Cc: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> |
| Subject: | Re: Misplaced superuser check in pg_log_backend_memory_contexts() |
| Date: | 2021-06-06 13:33:46 |
| Message-ID: | CALj2ACWA2xYpZp3qCSTEcxbu6y9_V9_1hY3YZpS5rrzHoVgVDw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Sun, Jun 6, 2021 at 12:23 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> Hi all,
>
> While reading the code of pg_log_backend_memory_contexts(), I have
> been surprised to see that the code would attempt to look at a PROC
> entry based on the given input PID *before* checking if the function
> has been called by a superuser. This does not strike me as a good
> idea as this allows any users to call this function and to take
> ProcArrayLock in shared mode, freely.
>
> It seems to me that we had better check for a superuser at the
> beginning of the function, like in the attached.
pg_signal_backend still locks ProcArrayLock in shared mode first and then
checks for the superuser permissions. Of course, it does that for the
roleId i.e. superuser_arg(proc->roleId), but there's also superuser() check.
With Regards,
Bharath Rupireddy.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Omar Kilani | 2021-06-06 13:41:52 | Re: Strangeness with UNIQUE indexes and UTF-8 |
| Previous Message | David Rowley | 2021-06-06 11:59:39 | Re: Strangeness with UNIQUE indexes and UTF-8 |