aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-01-02 12:48:13 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2019-01-02 12:48:13 -0500
commitd9a7fa67b4bfe6ce93ee9aab23ae2e7ca0763e84 (patch)
treeea15c22c088160107c09da1c8d380753bb0c8d21 /include
parentf218a29c25ad8abdb961435d6b8139f462061364 (diff)
parent55b8cbe470d103b44104c64dbf89e5cad525d4e0 (diff)
Merge branch 'next-seccomp' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull seccomp updates from James Morris: - Add SECCOMP_RET_USER_NOTIF - seccomp fixes for sparse warnings and s390 build (Tycho) * 'next-seccomp' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: seccomp, s390: fix build for syscall type change seccomp: fix poor type promotion samples: add an example of seccomp user trap seccomp: add a return code to trap to userspace seccomp: switch system call argument type to void * seccomp: hoist struct seccomp_data recalculation higher
Diffstat (limited to 'include')
-rw-r--r--include/linux/seccomp.h9
-rw-r--r--include/linux/syscalls.h2
-rw-r--r--include/uapi/linux/seccomp.h40
3 files changed, 43 insertions, 8 deletions
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index e5320f6c8654..84868d37b35d 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -4,9 +4,10 @@
4 4
5#include <uapi/linux/seccomp.h> 5#include <uapi/linux/seccomp.h>
6 6
7#define SECCOMP_FILTER_FLAG_MASK (SECCOMP_FILTER_FLAG_TSYNC | \ 7#define SECCOMP_FILTER_FLAG_MASK (SECCOMP_FILTER_FLAG_TSYNC | \
8 SECCOMP_FILTER_FLAG_LOG | \ 8 SECCOMP_FILTER_FLAG_LOG | \
9 SECCOMP_FILTER_FLAG_SPEC_ALLOW) 9 SECCOMP_FILTER_FLAG_SPEC_ALLOW | \
10 SECCOMP_FILTER_FLAG_NEW_LISTENER)
10 11
11#ifdef CONFIG_SECCOMP 12#ifdef CONFIG_SECCOMP
12 13
@@ -43,7 +44,7 @@ extern void secure_computing_strict(int this_syscall);
43#endif 44#endif
44 45
45extern long prctl_get_seccomp(void); 46extern long prctl_get_seccomp(void);
46extern long prctl_set_seccomp(unsigned long, char __user *); 47extern long prctl_set_seccomp(unsigned long, void __user *);
47 48
48static inline int seccomp_mode(struct seccomp *s) 49static inline int seccomp_mode(struct seccomp *s)
49{ 50{
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 251979d2e709..257cccba3062 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -898,7 +898,7 @@ asmlinkage long sys_renameat2(int olddfd, const char __user *oldname,
898 int newdfd, const char __user *newname, 898 int newdfd, const char __user *newname,
899 unsigned int flags); 899 unsigned int flags);
900asmlinkage long sys_seccomp(unsigned int op, unsigned int flags, 900asmlinkage long sys_seccomp(unsigned int op, unsigned int flags,
901 const char __user *uargs); 901 void __user *uargs);
902asmlinkage long sys_getrandom(char __user *buf, size_t count, 902asmlinkage long sys_getrandom(char __user *buf, size_t count,
903 unsigned int flags); 903 unsigned int flags);
904asmlinkage long sys_memfd_create(const char __user *uname_ptr, unsigned int flags); 904asmlinkage long sys_memfd_create(const char __user *uname_ptr, unsigned int flags);
diff --git a/include/uapi/linux/seccomp.h b/include/uapi/linux/seccomp.h
index 9efc0e73d50b..90734aa5aa36 100644
--- a/include/uapi/linux/seccomp.h
+++ b/include/uapi/linux/seccomp.h
@@ -15,11 +15,13 @@
15#define SECCOMP_SET_MODE_STRICT 0 15#define SECCOMP_SET_MODE_STRICT 0
16#define SECCOMP_SET_MODE_FILTER 1 16#define SECCOMP_SET_MODE_FILTER 1
17#define SECCOMP_GET_ACTION_AVAIL 2 17#define SECCOMP_GET_ACTION_AVAIL 2
18#define SECCOMP_GET_NOTIF_SIZES 3
18 19
19/* Valid flags for SECCOMP_SET_MODE_FILTER */ 20/* Valid flags for SECCOMP_SET_MODE_FILTER */
20#define SECCOMP_FILTER_FLAG_TSYNC (1UL << 0) 21#define SECCOMP_FILTER_FLAG_TSYNC (1UL << 0)
21#define SECCOMP_FILTER_FLAG_LOG (1UL << 1) 22#define SECCOMP_FILTER_FLAG_LOG (1UL << 1)
22#define SECCOMP_FILTER_FLAG_SPEC_ALLOW (1UL << 2) 23#define SECCOMP_FILTER_FLAG_SPEC_ALLOW (1UL << 2)
24#define SECCOMP_FILTER_FLAG_NEW_LISTENER (1UL << 3)
23 25
24/* 26/*
25 * All BPF programs must return a 32-bit value. 27 * All BPF programs must return a 32-bit value.
@@ -35,6 +37,7 @@
35#define SECCOMP_RET_KILL SECCOMP_RET_KILL_THREAD 37#define SECCOMP_RET_KILL SECCOMP_RET_KILL_THREAD
36#define SECCOMP_RET_TRAP 0x00030000U /* disallow and force a SIGSYS */ 38#define SECCOMP_RET_TRAP 0x00030000U /* disallow and force a SIGSYS */
37#define SECCOMP_RET_ERRNO 0x00050000U /* returns an errno */ 39#define SECCOMP_RET_ERRNO 0x00050000U /* returns an errno */
40#define SECCOMP_RET_USER_NOTIF 0x7fc00000U /* notifies userspace */
38#define SECCOMP_RET_TRACE 0x7ff00000U /* pass to a tracer or disallow */ 41#define SECCOMP_RET_TRACE 0x7ff00000U /* pass to a tracer or disallow */
39#define SECCOMP_RET_LOG 0x7ffc0000U /* allow after logging */ 42#define SECCOMP_RET_LOG 0x7ffc0000U /* allow after logging */
40#define SECCOMP_RET_ALLOW 0x7fff0000U /* allow */ 43#define SECCOMP_RET_ALLOW 0x7fff0000U /* allow */
@@ -60,4 +63,35 @@ struct seccomp_data {
60 __u64 args[6]; 63 __u64 args[6];
61}; 64};
62 65
66struct seccomp_notif_sizes {
67 __u16 seccomp_notif;
68 __u16 seccomp_notif_resp;
69 __u16 seccomp_data;
70};
71
72struct seccomp_notif {
73 __u64 id;
74 __u32 pid;
75 __u32 flags;
76 struct seccomp_data data;
77};
78
79struct seccomp_notif_resp {
80 __u64 id;
81 __s64 val;
82 __s32 error;
83 __u32 flags;
84};
85
86#define SECCOMP_IOC_MAGIC '!'
87#define SECCOMP_IO(nr) _IO(SECCOMP_IOC_MAGIC, nr)
88#define SECCOMP_IOR(nr, type) _IOR(SECCOMP_IOC_MAGIC, nr, type)
89#define SECCOMP_IOW(nr, type) _IOW(SECCOMP_IOC_MAGIC, nr, type)
90#define SECCOMP_IOWR(nr, type) _IOWR(SECCOMP_IOC_MAGIC, nr, type)
91
92/* Flags for seccomp notification fd ioctl. */
93#define SECCOMP_IOCTL_NOTIF_RECV SECCOMP_IOWR(0, struct seccomp_notif)
94#define SECCOMP_IOCTL_NOTIF_SEND SECCOMP_IOWR(1, \
95 struct seccomp_notif_resp)
96#define SECCOMP_IOCTL_NOTIF_ID_VALID SECCOMP_IOR(2, __u64)
63#endif /* _UAPI_LINUX_SECCOMP_H */ 97#endif /* _UAPI_LINUX_SECCOMP_H */