diff options
author | Kees Cook <keescook@chromium.org> | 2017-02-07 18:18:51 -0500 |
---|---|---|
committer | James Morris <james.l.morris@oracle.com> | 2017-02-22 17:42:35 -0500 |
commit | d7276e321ff8a53106a59c85ca46d03e34288893 (patch) | |
tree | e3b752b1b1a94ff0794e29e5658dfd48dd9b7d4d | |
parent | 37c85961c3f87f2141c84e53df31e59db072fd2e (diff) |
seccomp: Only dump core when single-threaded
The SECCOMP_RET_KILL filter return code has always killed the current
thread, not the entire process. Changing this as a side-effect of dumping
core isn't a safe thing to do (a few test suites have already flagged this
behavioral change). Instead, restore the RET_KILL semantics, but still
dump core when a RET_KILL delivers SIGSYS to a single-threaded process.
Fixes: b25e67161c29 ("seccomp: dump core when using SECCOMP_RET_KILL")
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
-rw-r--r-- | kernel/seccomp.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/kernel/seccomp.c b/kernel/seccomp.c index f8f88ebcb3ba..e15185c28de5 100644 --- a/kernel/seccomp.c +++ b/kernel/seccomp.c | |||
@@ -643,11 +643,14 @@ static int __seccomp_filter(int this_syscall, const struct seccomp_data *sd, | |||
643 | default: { | 643 | default: { |
644 | siginfo_t info; | 644 | siginfo_t info; |
645 | audit_seccomp(this_syscall, SIGSYS, action); | 645 | audit_seccomp(this_syscall, SIGSYS, action); |
646 | /* Show the original registers in the dump. */ | 646 | /* Dump core only if this is the last remaining thread. */ |
647 | syscall_rollback(current, task_pt_regs(current)); | 647 | if (get_nr_threads(current) == 1) { |
648 | /* Trigger a manual coredump since do_exit skips it. */ | 648 | /* Show the original registers in the dump. */ |
649 | seccomp_init_siginfo(&info, this_syscall, data); | 649 | syscall_rollback(current, task_pt_regs(current)); |
650 | do_coredump(&info); | 650 | /* Trigger a manual coredump since do_exit skips it. */ |
651 | seccomp_init_siginfo(&info, this_syscall, data); | ||
652 | do_coredump(&info); | ||
653 | } | ||
651 | do_exit(SIGSYS); | 654 | do_exit(SIGSYS); |
652 | } | 655 | } |
653 | } | 656 | } |