Skip to content

Commit 61b5ebd

Browse files
committed
Merge tag 'seccomp-v4.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull seccomp fix from Kees Cook: "Fix fatal signal delivery after ptrace reordering" * tag 'seccomp-v4.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: seccomp: Fix tracer exit notifications during fatal signals
2 parents 86a1679 + 485a252 commit 61b5ebd

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

kernel/seccomp.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -605,12 +605,16 @@ static int __seccomp_filter(int this_syscall, const struct seccomp_data *sd,
605605
ptrace_event(PTRACE_EVENT_SECCOMP, data);
606606
/*
607607
* The delivery of a fatal signal during event
608-
* notification may silently skip tracer notification.
609-
* Terminating the task now avoids executing a system
610-
* call that may not be intended.
608+
* notification may silently skip tracer notification,
609+
* which could leave us with a potentially unmodified
610+
* syscall that the tracer would have liked to have
611+
* changed. Since the process is about to die, we just
612+
* force the syscall to be skipped and let the signal
613+
* kill the process and correctly handle any tracer exit
614+
* notifications.
611615
*/
612616
if (fatal_signal_pending(current))
613-
do_exit(SIGSYS);
617+
goto skip;
614618
/* Check if the tracer forced the syscall to be skipped. */
615619
this_syscall = syscall_get_nr(current, task_pt_regs(current));
616620
if (this_syscall < 0)

0 commit comments

Comments
 (0)