1 #ifndef _LINUX_SECCOMP_H
2 #define _LINUX_SECCOMP_H
4 #include <uapi/linux/seccomp.h>
8 #include <linux/thread_info.h>
9 #include <asm/seccomp.h>
11 struct seccomp_filter;
13 * struct seccomp - the state of a seccomp'ed process
15 * @mode: indicates one of the valid values above for controlled
16 * system calls available to a process.
17 * @filter: The metadata and ruleset for determining what system calls
18 * are allowed for a task.
20 * @filter must only be accessed from the context of current as there
25 struct seccomp_filter *filter;
28 extern int __secure_computing(int);
29 static inline int secure_computing(int this_syscall)
31 if (unlikely(test_thread_flag(TIF_SECCOMP)))
32 return __secure_computing(this_syscall);
36 /* A wrapper for architectures supporting only SECCOMP_MODE_STRICT. */
37 static inline void secure_computing_strict(int this_syscall)
39 BUG_ON(secure_computing(this_syscall) != 0);
42 extern long prctl_get_seccomp(void);
43 extern long prctl_set_seccomp(unsigned long, char __user *);
45 static inline int seccomp_mode(struct seccomp *s)
50 #else /* CONFIG_SECCOMP */
52 #include <linux/errno.h>
55 struct seccomp_filter { };
57 static inline int secure_computing(int this_syscall) { return 0; }
58 static inline void secure_computing_strict(int this_syscall) { return; }
60 static inline long prctl_get_seccomp(void)
65 static inline long prctl_set_seccomp(unsigned long arg2, char __user *arg3)
70 static inline int seccomp_mode(struct seccomp *s)
74 #endif /* CONFIG_SECCOMP */
76 #ifdef CONFIG_SECCOMP_FILTER
77 extern void put_seccomp_filter(struct task_struct *tsk);
78 extern void get_seccomp_filter(struct task_struct *tsk);
79 extern u32 seccomp_bpf_load(int off);
80 #else /* CONFIG_SECCOMP_FILTER */
81 static inline void put_seccomp_filter(struct task_struct *tsk)
85 static inline void get_seccomp_filter(struct task_struct *tsk)
89 #endif /* CONFIG_SECCOMP_FILTER */
90 #endif /* _LINUX_SECCOMP_H */