linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] signals: work around random wakeups in sigsuspend()
@ 2016-01-25 15:21 Sasha Levin
  2016-01-25 19:09 ` Oleg Nesterov
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Sasha Levin @ 2016-01-25 15:21 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, mingo, oleg, peterz, Sasha Levin

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;
 }
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2016-02-25 17:34 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-25 15:21 [PATCH] signals: work around random wakeups in sigsuspend() Sasha Levin
2016-01-25 19:09 ` Oleg Nesterov
2016-01-25 19:37   ` Peter Zijlstra
2016-02-25  3:18   ` Al Viro
2016-02-25  8:11     ` Peter Zijlstra
2016-02-25 17:34       ` Al Viro
2016-01-25 21:32 ` Andrew Morton
2016-01-26 21:10   ` Oleg Nesterov
2016-01-27  8:44     ` Peter Zijlstra
2016-01-27 16:41       ` Oleg Nesterov
2016-01-27 17:54         ` Peter Zijlstra
2016-01-27 18:39         ` Andrew Morton
2016-01-27 21:07           ` Oleg Nesterov
2016-01-27 17:24       ` Sasha Levin
2016-01-26  6:44 ` Ingo Molnar
2016-01-26 15:05   ` Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).