signal/seccomp: Dump core when there is only one live thread

Replace get_nr_threads with atomic_read(&current->signal->live) as
that is a more accurate number that is decremented sooner.

Acked-by: Kees Cook <keescook@chromium.org>
Link: https://lkml.kernel.org/r/87lf6z6qbd.fsf_-_@disp2133
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
This commit is contained in:
Eric W. Biederman 2021-06-23 16:51:49 -05:00
parent 307d522f5e
commit d21918e5a9

View File

@ -1264,7 +1264,7 @@ static int __seccomp_filter(int this_syscall, const struct seccomp_data *sd,
seccomp_log(this_syscall, SIGSYS, action, true); seccomp_log(this_syscall, SIGSYS, action, true);
/* Dump core only if this is the last remaining thread. */ /* Dump core only if this is the last remaining thread. */
if (action != SECCOMP_RET_KILL_THREAD || if (action != SECCOMP_RET_KILL_THREAD ||
get_nr_threads(current) == 1) { (atomic_read(&current->signal->live) == 1)) {
/* Show the original registers in the dump. */ /* Show the original registers in the dump. */
syscall_rollback(current, current_pt_regs()); syscall_rollback(current, current_pt_regs());
/* Trigger a coredump with SIGSYS */ /* Trigger a coredump with SIGSYS */