Re: Patch to allow users to kill their own queries

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Greg Smith <greg(at)2ndquadrant(dot)com>, Josh Kupershmidt <schmiddy(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch to allow users to kill their own queries
Date: 2011-12-16 14:37:58
Message-ID: CABUevEzFJfbgjA9wS1ThQ5m3bfEoJ5xZEm4Fi4YQEZhfQbHWpg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Friday, December 16, 2011, Robert Haas wrote:

> On Fri, Dec 16, 2011 at 1:21 AM, Greg Smith <greg(at)2ndquadrant(dot)com<javascript:;>>
> wrote:
> > This is a problem with the existing code though, and the proposed changes
> > don't materially alter that; there's just another quick check in one path
> > through. Right now we check if someone is superuser, then if it's a
> backend
> > PID, then we send the signal. If you assume someone can run through all
> the
> > PIDs between those checks and the kill, the system is already broken that
> > way.
>
> From a theoretical point of view, I believe it to be slightly
> different. If a superuser sends a kill, they will certainly be
> authorized to kill whatever they end up killing, because they are
> authorized to kill anything. On the other hand, the proposed patch
>

Not necessarily. What if it's recycled as a backend in a different postgres
installation. Or just a cronjob or shell running as the same user?

Sure, you can argue that the superuser can destroy anything he wants - but
in that case, why do we have a check for this at all in the first place?

I think we can safely say that any OS that actually manages to recycle the
PID in the short time it takes to get between those instructions is so
broken we don't need to care about that.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2011-12-16 14:38:40 Re: Patch to allow users to kill their own queries
Previous Message Greg Smith 2011-12-16 14:19:52 Re: Patch to allow users to kill their own queries