Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1317565
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] signals: work around random wakeups in sigsuspend() |
| Date | 2016-01-26 07:50 +0100 |
| Message-ID | <qV5BT-8fo-1@gated-at.bofh.it> (permalink) |
| References | <qURIG-68y-83@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
* Sasha Levin <sasha.levin@oracle.com> wrote:
> A random wakeup can get us out of sigsuspend() without TIF_SIGPENDING
> being set.
>
> Avoid that by making sure we were signaled, like sys_pause() does.
>
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
> kernel/signal.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/signal.c b/kernel/signal.c
> index 5da9180..3256c7e 100644
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -3528,8 +3528,10 @@ static int sigsuspend(sigset_t *set)
> current->saved_sigmask = current->blocked;
> set_current_blocked(set);
>
> - __set_current_state(TASK_INTERRUPTIBLE);
> - schedule();
> + while (!signal_pending(current)) {
> + __set_current_state(TASK_INTERRUPTIBLE);
> + schedule();
> + }
> set_restore_sigmask();
> return -ERESTARTNOHAND;
> }
So this does not appear to be anything new, right?
I agree with the fix, but I'm somewhat worried about the potential ABI impact:
does anything exist out there that has learned to rely on spurious returns from
SyS_sigsuspend() or SyS_rt_sigsuspend() system calls? These are one of the most
frequently used system calls in signal based event loops.
Thanks,
Ingo
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] signals: work around random wakeups in sigsuspend() Sasha Levin <sasha.levin@oracle.com> - 2016-01-25 17:00 +0100
Re: [PATCH] signals: work around random wakeups in sigsuspend() Oleg Nesterov <oleg@redhat.com> - 2016-01-25 20:10 +0100
Re: [PATCH] signals: work around random wakeups in sigsuspend() Peter Zijlstra <peterz@infradead.org> - 2016-01-25 20:40 +0100
Re: [PATCH] signals: work around random wakeups in sigsuspend() Andrew Morton <akpm@linux-foundation.org> - 2016-01-25 22:40 +0100
Re: [PATCH] signals: work around random wakeups in sigsuspend() Oleg Nesterov <oleg@redhat.com> - 2016-01-26 22:20 +0100
Re: [PATCH] signals: work around random wakeups in sigsuspend() Peter Zijlstra <peterz@infradead.org> - 2016-01-27 09:50 +0100
Re: [PATCH] signals: work around random wakeups in sigsuspend() Oleg Nesterov <oleg@redhat.com> - 2016-01-27 17:50 +0100
Re: [PATCH] signals: work around random wakeups in sigsuspend() Peter Zijlstra <peterz@infradead.org> - 2016-01-27 19:00 +0100
Re: [PATCH] signals: work around random wakeups in sigsuspend() Andrew Morton <akpm@linux-foundation.org> - 2016-01-27 19:40 +0100
Re: [PATCH] signals: work around random wakeups in sigsuspend() Oleg Nesterov <oleg@redhat.com> - 2016-01-27 22:10 +0100
Re: [PATCH] signals: work around random wakeups in sigsuspend() Sasha Levin <sasha.levin@oracle.com> - 2016-01-27 18:30 +0100
Re: [PATCH] signals: work around random wakeups in sigsuspend() Ingo Molnar <mingo@kernel.org> - 2016-01-26 07:50 +0100
Re: [PATCH] signals: work around random wakeups in sigsuspend() Oleg Nesterov <oleg@redhat.com> - 2016-01-26 16:10 +0100
csiph-web