Messages in this thread Patch in this message |  | | From | Kyle Huey <> | Subject | [PATCH 2/2] signal: after notifying a ptracer of a signal, recheck for pending SIGKILLs | Date | Sun, 31 Oct 2021 20:41:47 -0700 |
| |
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
|  |