lkml.org 
[lkml]   [2012]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] TIF_NOTIFY_RESUME, arch/*/*/*signal*.c and all such
On 04/25, Al Viro wrote:
>
> On Wed, Apr 25, 2012 at 02:37:46PM +0200, Oleg Nesterov wrote:
> > As for sys_sigsuspend() and this race in particular:
> >
> > > Arrival of a signal that has userland handler
> > > and that isn't blocked by the mask given to sigsuspend() should terminate
> > > sigsuspend().
> >
> > Yes. But note that do_signal() restores the old sigmask. This means that
> > the signal we get after the first do_signal() was not blocked before
> > sigsuspend() was called. So, to some extent, we can pretend that the
> > handler was executed before sigsuspend() and it was never restarted.
>
> Signal might have already arrived by the time we restore sigmask.

Yes, and it sets TIF_SIGPENDING, but unless I missed something this doesn't
matter.

> So no,
> it might have been blocked prior to sigsuspend().

If it was not blocked, then the next do_signal()->get_signal_to_deliver()
returns 0 and clears TIF_SIGPENDING. After that we finally re-enter
sys_sigsuspend() and (assuming it unblocks this sig) notice this pending
signal again and return -EINTR eventually.

Oleg.



\
 
 \ /
  Last update: 2012-04-25 15:07    [W:0.389 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site