Re: Allow non-superuser to cancel superuser tasks.

From: Kirill Reshke <reshkekirill(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: "Leung, Anthony" <antholeu(at)amazon(dot)com>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Allow non-superuser to cancel superuser tasks.
Date: 2024-04-09 21:52:19
Message-ID: CALdSSPjVmZMcFm14dzzAGenssJAmV400wBYA=UNWMi9aJeXJMw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, thanks for looking into this.

On Tue, 9 Apr 2024 at 08:53, Michael Paquier <michael(at)paquier(dot)xyz> wrote:

> On Mon, Apr 08, 2024 at 05:42:05PM +0000, Leung, Anthony wrote:
> > Are you suggesting that we check if the backend is B_AUTOVAC in
> > pg_cancel/ terminate_backend? That seems a bit unclean to me since
> > pg_cancel_backend & pg_cancel_backend does not access to the
> > procNumber to check the type of the backend.
> >
> > IMHO, we can keep SIGNAL_BACKEND_NOAUTOVACUUM but just improve the
> > errmsg / errdetail to not expose that the backend is an AV
> > worker. It'll also be helpful if you can suggest what errdetail we
> > should use here.
>
> The thing is that you cannot rely on a lookup of the backend type for
> the error information, or you open yourself to letting the caller of
> pg_cancel_backend or pg_terminate_backend know if a backend is
> controlled by a superuser or if a backend is an autovacuum worker.
>

Good catch. Thanks. I think we need to update the error message to not
leak backend type info.

> The choice of pg_signal_autovacuum is a bit inconsistent, as well,
> because autovacuum workers operate like regular backends. This name
> can also be confused with the autovacuum launcher.

Ok. What would be a good choice? Is `pg_signal_autovacuum_worker` good
enough?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2024-04-09 22:33:10 Re: Speed up clean meson builds by ~25%
Previous Message Bruce Momjian 2024-04-09 21:16:27 Re: PostgreSQL 17 Release Management Team & Feature Freeze