aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel
diff options
context:
space:
mode:
authorMickaël Salaün <mic@digikod.net>2015-12-29 15:35:47 -0500
committerRichard Weinberger <richard@nod.at>2016-01-10 15:49:49 -0500
commitc50b4659e444b020657e01bdf769c965e5597cb0 (patch)
tree700ad5bdbc1726819971e0f258d49dd778606c5f /arch/um/kernel
parentd8f8b8445648c267a24f30a72533e77cb6543f21 (diff)
um: Add seccomp support
This brings SECCOMP_MODE_STRICT and SECCOMP_MODE_FILTER support through prctl(2) and seccomp(2) to User-mode Linux for i386 and x86_64 subarchitectures. secure_computing() is called first in handle_syscall() so that the syscall emulation will be aborted quickly if matching a seccomp rule. This is inspired from Meredydd Luff's patch (https://gerrit.chromium.org/gerrit/21425). Signed-off-by: Mickaël Salaün <mic@digikod.net> Cc: Jeff Dike <jdike@addtoit.com> Cc: Richard Weinberger <richard@nod.at> Cc: Ingo Molnar <mingo@redhat.com> Cc: Kees Cook <keescook@chromium.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Will Drewry <wad@chromium.org> Cc: Chris Metcalf <cmetcalf@ezchip.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: James Hogan <james.hogan@imgtec.com> Cc: Meredydd Luff <meredydd@senatehouse.org> Cc: David Drysdale <drysdale@google.com> Signed-off-by: Richard Weinberger <richard@nod.at> Acked-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'arch/um/kernel')
-rw-r--r--arch/um/kernel/skas/syscall.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/um/kernel/skas/syscall.c b/arch/um/kernel/skas/syscall.c
index 6cadce761bcf..48b0dcbd87be 100644
--- a/arch/um/kernel/skas/syscall.c
+++ b/arch/um/kernel/skas/syscall.c
@@ -5,6 +5,7 @@
5 5
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/ptrace.h> 7#include <linux/ptrace.h>
8#include <linux/seccomp.h>
8#include <kern_util.h> 9#include <kern_util.h>
9#include <sysdep/ptrace.h> 10#include <sysdep/ptrace.h>
10#include <sysdep/ptrace_user.h> 11#include <sysdep/ptrace_user.h>
@@ -19,6 +20,10 @@ void handle_syscall(struct uml_pt_regs *r)
19 UPT_SYSCALL_NR(r) = PT_SYSCALL_NR(r->gp); 20 UPT_SYSCALL_NR(r) = PT_SYSCALL_NR(r->gp);
20 PT_REGS_SET_SYSCALL_RETURN(regs, -ENOSYS); 21 PT_REGS_SET_SYSCALL_RETURN(regs, -ENOSYS);
21 22
23 /* Do the secure computing check first; failures should be fast. */
24 if (secure_computing() == -1)
25 return;
26
22 if (syscall_trace_enter(regs)) 27 if (syscall_trace_enter(regs))
23 goto out; 28 goto out;
24 29