aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-13 20:27:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-13 20:27:06 -0400
commitba1a96fc7ddcaf0c8d4a6752f6a70f080bc307ac (patch)
treec07af88f62df1ab8ed98aab9951dd05dff09d0d2 /include/linux
parentf1bfbd984b4e2177886507b6a0ec5faeb6d7c217 (diff)
parent1dcf74f6edfc3a9acd84d83d8865dd9e2a3b1d1e (diff)
Merge branch 'x86-seccomp-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 seccomp changes from Ingo Molnar: "This tree includes x86 seccomp filter speedups and related preparatory work, which touches core seccomp facilities as well. The main idea is to split seccomp into two phases, to be able to enter a simple fast path for syscalls with ptrace side effects. There's no substantial user-visible (and ABI) effects expected from this, except a change in how we emit a better audit record for SECCOMP_RET_TRACE events" * 'x86-seccomp-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86_64, entry: Use split-phase syscall_trace_enter for 64-bit syscalls x86_64, entry: Treat regs->ax the same in fastpath and slowpath syscalls x86: Split syscall_trace_enter into two phases x86, entry: Only call user_exit if TIF_NOHZ x86, x32, audit: Fix x32's AUDIT_ARCH wrt audit seccomp: Document two-phase seccomp and arch-provided seccomp_data seccomp: Allow arch code to provide seccomp_data seccomp: Refactor the filter callback and the API seccomp,x86,arm,mips,s390: Remove nr parameter from secure_computing
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/seccomp.h25
1 files changed, 16 insertions, 9 deletions
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index 5d586a45a319..a19ddacdac30 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -27,19 +27,23 @@ struct seccomp {
27 struct seccomp_filter *filter; 27 struct seccomp_filter *filter;
28}; 28};
29 29
30extern int __secure_computing(int); 30#ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER
31static inline int secure_computing(int this_syscall) 31extern int __secure_computing(void);
32static inline int secure_computing(void)
32{ 33{
33 if (unlikely(test_thread_flag(TIF_SECCOMP))) 34 if (unlikely(test_thread_flag(TIF_SECCOMP)))
34 return __secure_computing(this_syscall); 35 return __secure_computing();
35 return 0; 36 return 0;
36} 37}
37 38
38/* A wrapper for architectures supporting only SECCOMP_MODE_STRICT. */ 39#define SECCOMP_PHASE1_OK 0
39static inline void secure_computing_strict(int this_syscall) 40#define SECCOMP_PHASE1_SKIP 1
40{ 41
41 BUG_ON(secure_computing(this_syscall) != 0); 42extern u32 seccomp_phase1(struct seccomp_data *sd);
42} 43int seccomp_phase2(u32 phase1_result);
44#else
45extern void secure_computing_strict(int this_syscall);
46#endif
43 47
44extern long prctl_get_seccomp(void); 48extern long prctl_get_seccomp(void);
45extern long prctl_set_seccomp(unsigned long, char __user *); 49extern long prctl_set_seccomp(unsigned long, char __user *);
@@ -56,8 +60,11 @@ static inline int seccomp_mode(struct seccomp *s)
56struct seccomp { }; 60struct seccomp { };
57struct seccomp_filter { }; 61struct seccomp_filter { };
58 62
59static inline int secure_computing(int this_syscall) { return 0; } 63#ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER
64static inline int secure_computing(void) { return 0; }
65#else
60static inline void secure_computing_strict(int this_syscall) { return; } 66static inline void secure_computing_strict(int this_syscall) { return; }
67#endif
61 68
62static inline long prctl_get_seccomp(void) 69static inline long prctl_get_seccomp(void)
63{ 70{