Commit e7f7c99b authored by Eric W. Biederman's avatar Eric W. Biederman

signal: In get_signal test for signal_group_exit every time through the loop

Recently while investigating a problem with rr and signals I noticed
that siglock is dropped in ptrace_signal and get_signal does not jump
to relock.

Looking farther to see if the problem is anywhere else I see that
do_signal_stop also returns if signal_group_exit is true.  I believe
that test can now never be true, but it is a bit hard to trace
through and be certain.

Testing signal_group_exit is not expensive, so move the test for
signal_group_exit into the for loop inside of get_signal to ensure
the test is never skipped improperly.

This has been a potential problem since I added the test for
signal_group_exit was added.

Fixes: 35634ffa ("signal: Always notice exiting tasks")
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Link: https://lkml.kernel.org/r/875yssekcd.fsf_-_@email.froward.int.ebiederm.orgSigned-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
parent fa55b7dc
...@@ -2662,6 +2662,9 @@ bool get_signal(struct ksignal *ksig) ...@@ -2662,6 +2662,9 @@ bool get_signal(struct ksignal *ksig)
goto relock; goto relock;
} }
for (;;) {
struct k_sigaction *ka;
/* Has this task already been marked for death? */ /* Has this task already been marked for death? */
if (signal_group_exit(signal)) { if (signal_group_exit(signal)) {
ksig->info.si_signo = signr = SIGKILL; ksig->info.si_signo = signr = SIGKILL;
...@@ -2672,9 +2675,6 @@ bool get_signal(struct ksignal *ksig) ...@@ -2672,9 +2675,6 @@ bool get_signal(struct ksignal *ksig)
goto fatal; goto fatal;
} }
for (;;) {
struct k_sigaction *ka;
if (unlikely(current->jobctl & JOBCTL_STOP_PENDING) && if (unlikely(current->jobctl & JOBCTL_STOP_PENDING) &&
do_signal_stop(0)) do_signal_stop(0))
goto relock; goto relock;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment