From: Oleg Nesterov <oleg@redhat.com>
Date: Wed, 25 May 2011 17:22:27 +0000 (+0200)
Subject: signal: sys_pause() should check signal_pending()
X-Git-Tag: firefly_0821_release~7613^2~1140^2
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d92fcf0552a15891b25c343cee340d295e24109c;p=firefly-linux-kernel-4.4.55.git

signal: sys_pause() should check signal_pending()

ERESTART* is always wrong without TIF_SIGPENDING. Teach sys_pause()
to handle the spurious wakeup correctly.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---

diff --git a/kernel/signal.c b/kernel/signal.c
index ad5e818baacc..86c32b884f8e 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -3023,8 +3023,10 @@ SYSCALL_DEFINE2(signal, int, sig, __sighandler_t, handler)
 
 SYSCALL_DEFINE0(pause)
 {
-	current->state = TASK_INTERRUPTIBLE;
-	schedule();
+	while (!signal_pending(current)) {
+		current->state = TASK_INTERRUPTIBLE;
+		schedule();
+	}
 	return -ERESTARTNOHAND;
 }