Files
linux-apfs/include/linux/seccomp.h
T

91 lines
2.1 KiB
C
Raw Normal View History

2005-04-16 15:20:36 -07:00
#ifndef _LINUX_SECCOMP_H
#define _LINUX_SECCOMP_H
2012-10-13 10:46:48 +01:00
#include <uapi/linux/seccomp.h>
2005-04-16 15:20:36 -07:00
#ifdef CONFIG_SECCOMP
#include <linux/thread_info.h>
#include <asm/seccomp.h>
struct seccomp_filter;
/**
* struct seccomp - the state of a seccomp'ed process
*
* @mode: indicates one of the valid values above for controlled
* system calls available to a process.
* @filter: The metadata and ruleset for determining what system calls
* are allowed for a task.
*
* @filter must only be accessed from the context of current as there
* is no locking.
*/
2012-04-12 16:47:54 -05:00
struct seccomp {
int mode;
struct seccomp_filter *filter;
2012-04-12 16:47:54 -05:00
};
2005-04-16 15:20:36 -07:00
2012-04-12 16:47:59 -05:00
extern int __secure_computing(int);
static inline int secure_computing(int this_syscall)
2005-04-16 15:20:36 -07:00
{
if (unlikely(test_thread_flag(TIF_SECCOMP)))
2012-04-12 16:47:59 -05:00
return __secure_computing(this_syscall);
return 0;
2005-04-16 15:20:36 -07:00
}
/* A wrapper for architectures supporting only SECCOMP_MODE_STRICT. */
static inline void secure_computing_strict(int this_syscall)
{
BUG_ON(secure_computing(this_syscall) != 0);
}
2007-07-15 23:41:32 -07:00
extern long prctl_get_seccomp(void);
extern long prctl_set_seccomp(unsigned long, char __user *);
2007-07-15 23:41:32 -07:00
2012-04-12 16:47:54 -05:00
static inline int seccomp_mode(struct seccomp *s)
2011-06-05 13:50:24 -04:00
{
return s->mode;
}
2005-04-16 15:20:36 -07:00
#else /* CONFIG_SECCOMP */
#include <linux/errno.h>
2012-04-12 16:47:54 -05:00
struct seccomp { };
struct seccomp_filter { };
2005-04-16 15:20:36 -07:00
static inline int secure_computing(int this_syscall) { return 0; }
static inline void secure_computing_strict(int this_syscall) { return; }
2005-04-16 15:20:36 -07:00
2007-07-15 23:41:32 -07:00
static inline long prctl_get_seccomp(void)
{
return -EINVAL;
}
static inline long prctl_set_seccomp(unsigned long arg2, char __user *arg3)
2007-07-15 23:41:32 -07:00
{
return -EINVAL;
}
2012-04-12 16:47:54 -05:00
static inline int seccomp_mode(struct seccomp *s)
2011-06-05 13:50:24 -04:00
{
return 0;
}
2005-04-16 15:20:36 -07:00
#endif /* CONFIG_SECCOMP */
#ifdef CONFIG_SECCOMP_FILTER
extern void put_seccomp_filter(struct task_struct *tsk);
extern void get_seccomp_filter(struct task_struct *tsk);
extern u32 seccomp_bpf_load(int off);
#else /* CONFIG_SECCOMP_FILTER */
static inline void put_seccomp_filter(struct task_struct *tsk)
{
return;
}
static inline void get_seccomp_filter(struct task_struct *tsk)
{
return;
}
#endif /* CONFIG_SECCOMP_FILTER */
2005-04-16 15:20:36 -07:00
#endif /* _LINUX_SECCOMP_H */