lkml.org 
[lkml]   [2021]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] signal: after notifying a ptracer of a signal, recheck for pending SIGKILLs
Date
ptrace_signal will release the siglock which could result in the current
task catching a SIGKILL that was not present on our first check in
get_signal. If that happens, bail out of the current signal and go
straight to the SIGKILL. This avoids setting up a frame for a signal
that the ptracer may not be notified of but that will be visible at
PTRACE_EVENT_EXIT.

Signed-off-by: Kyle Huey <khuey@kylehuey.com>
Reported-by: Marko Mäkelä <marko.makela@mariadb.com>
---
kernel/signal.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/kernel/signal.c b/kernel/signal.c
index 4d26ee5c662a..09810777c61b 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2738,6 +2738,13 @@ bool get_signal(struct ksignal *ksig)
signr = ptrace_signal(signr, &ksig->info);
if (!signr)
continue;
+ /*
+ * After calling the debugger anything could have changed.
+ * If there's a pending SIGKILL stop processing the current
+ * signal and skip straight to the end.
+ */
+ if (signal_group_exit(signal))
+ goto kill;
}

ka = &sighand->action[signr-1];
--
2.33.1
\
 
 \ /
  Last update: 2021-11-01 04:43    [W:0.116 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site