diff options
author | Kees Cook <keescook@chromium.org> | 2016-06-02 19:59:42 -0700 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2016-06-14 10:54:47 -0700 |
commit | 26703c636c1f3272b39bd0f6d04d2e970984f1b6 (patch) | |
tree | a23cb02922fdac007e7d97d9d4f40ef12bf0893e /arch/um/kernel/skas | |
parent | 635efc702984857b45a2a2491ed7a529e14cbdf9 (diff) | |
download | linux-26703c636c1f3272b39bd0f6d04d2e970984f1b6.tar.gz linux-26703c636c1f3272b39bd0f6d04d2e970984f1b6.tar.bz2 linux-26703c636c1f3272b39bd0f6d04d2e970984f1b6.zip |
um/ptrace: run seccomp after ptrace
Close the hole where ptrace can change a syscall out from under seccomp.
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: user-mode-linux-devel@lists.sourceforge.net
Diffstat (limited to 'arch/um/kernel/skas')
-rw-r--r-- | arch/um/kernel/skas/syscall.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/arch/um/kernel/skas/syscall.c b/arch/um/kernel/skas/syscall.c index 9c5570f0f397..ef4b8f949b51 100644 --- a/arch/um/kernel/skas/syscall.c +++ b/arch/um/kernel/skas/syscall.c @@ -20,12 +20,12 @@ void handle_syscall(struct uml_pt_regs *r) UPT_SYSCALL_NR(r) = PT_SYSCALL_NR(r->gp); PT_REGS_SET_SYSCALL_RETURN(regs, -ENOSYS); - /* Do the secure computing check first; failures should be fast. */ - if (secure_computing(NULL) == -1) + if (syscall_trace_enter(regs)) return; - if (syscall_trace_enter(regs)) - goto out; + /* Do the seccomp check after ptrace; failures should be fast. */ + if (secure_computing(NULL) == -1) + return; /* Update the syscall number after orig_ax has potentially been updated * with ptrace. @@ -37,6 +37,5 @@ void handle_syscall(struct uml_pt_regs *r) PT_REGS_SET_SYSCALL_RETURN(regs, EXECUTE_SYSCALL(syscall, regs)); -out: syscall_trace_leave(regs); } |