seccomp: Clean up core dump logic
authorKees Cook <keescook@chromium.org>
Thu, 23 Feb 2017 17:24:24 +0000 (09:24 -0800)
committerKees Cook <keescook@chromium.org>
Mon, 26 Jun 2017 16:22:33 +0000 (09:22 -0700)
This just cleans up the core dumping logic to avoid the braces around
the RET_KILL case.

Signed-off-by: Kees Cook <keescook@chromium.org>
kernel/seccomp.c

index 65f61077ad50d96098a86e839f593b98590785b9..fce83885b7eff603998a8058e5cf0fa41e1dc64c 100644 (file)
@@ -641,11 +641,12 @@ static int __seccomp_filter(int this_syscall, const struct seccomp_data *sd,
                return 0;
 
        case SECCOMP_RET_KILL:
-       default: {
-               siginfo_t info;
+       default:
                audit_seccomp(this_syscall, SIGSYS, action);
                /* Dump core only if this is the last remaining thread. */
                if (get_nr_threads(current) == 1) {
+                       siginfo_t info;
+
                        /* Show the original registers in the dump. */
                        syscall_rollback(current, task_pt_regs(current));
                        /* Trigger a manual coredump since do_exit skips it. */
@@ -654,7 +655,6 @@ static int __seccomp_filter(int this_syscall, const struct seccomp_data *sd,
                }
                do_exit(SIGSYS);
        }
-       }
 
        unreachable();