File tree Expand file tree Collapse file tree 5 files changed +24
-3
lines changed
Documentation/features/seccomp/seccomp-filter Expand file tree Collapse file tree 5 files changed +24
-3
lines changed Original file line number Diff line number Diff line change 30
30
| um: | ok |
31
31
| unicore32: | TODO |
32
32
| x86: | ok |
33
- | xtensa: | TODO |
33
+ | xtensa: | ok |
34
34
-----------------------
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ config XTENSA
24
24
select HAVE_ARCH_AUDITSYSCALL
25
25
select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
26
26
select HAVE_ARCH_KASAN if MMU && !XIP_KERNEL
27
+ select HAVE_ARCH_SECCOMP_FILTER
27
28
select HAVE_ARCH_TRACEHOOK
28
29
select HAVE_COPY_THREAD_TLS
29
30
select HAVE_DEBUG_KMEMLEAK
@@ -217,6 +218,20 @@ config HOTPLUG_CPU
217
218
218
219
Say N if you want to disable CPU hotplug.
219
220
221
+ config SECCOMP
222
+ bool
223
+ prompt "Enable seccomp to safely compute untrusted bytecode"
224
+ help
225
+ This kernel feature is useful for number crunching applications
226
+ that may need to compute untrusted bytecode during their
227
+ execution. By using pipes or other transports made available to
228
+ the process as file descriptors supporting the read/write
229
+ syscalls, it's possible to isolate those applications in
230
+ their own address space using seccomp. Once seccomp is
231
+ enabled via prctl(PR_SET_SECCOMP), it cannot be disabled
232
+ and the task is only allowed to execute a few safe syscalls
233
+ defined by each seccomp mode.
234
+
220
235
config FAST_SYSCALL_XTENSA
221
236
bool "Enable fast atomic syscalls"
222
237
default n
Original file line number Diff line number Diff line change @@ -7,4 +7,5 @@ generic-y += mcs_spinlock.h
7
7
generic-y += param.h
8
8
generic-y += qrwlock.h
9
9
generic-y += qspinlock.h
10
+ generic-y += seccomp.h
10
11
generic-y += user.h
Original file line number Diff line number Diff line change @@ -112,16 +112,19 @@ static inline struct thread_info *current_thread_info(void)
112
112
#define TIF_NOTIFY_RESUME 7 /* callback before returning to user */
113
113
#define TIF_DB_DISABLED 8 /* debug trap disabled for syscall */
114
114
#define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */
115
+ #define TIF_SECCOMP 10 /* secure computing */
115
116
116
117
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
117
118
#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
118
119
#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
119
120
#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
120
121
#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
121
122
#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
123
+ #define _TIF_SECCOMP (1<<TIF_SECCOMP)
122
124
123
125
#define _TIF_WORK_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
124
- _TIF_SYSCALL_TRACEPOINT | _TIF_SYSCALL_AUDIT)
126
+ _TIF_SYSCALL_TRACEPOINT | \
127
+ _TIF_SYSCALL_AUDIT | _TIF_SECCOMP)
125
128
126
129
#define THREAD_SIZE KERNEL_STACK_SIZE
127
130
#define THREAD_SIZE_ORDER (KERNEL_STACK_SHIFT - PAGE_SHIFT)
Original file line number Diff line number Diff line change 22
22
#include <linux/regset.h>
23
23
#include <linux/sched.h>
24
24
#include <linux/sched/task_stack.h>
25
+ #include <linux/seccomp.h>
25
26
#include <linux/security.h>
26
27
#include <linux/signal.h>
27
28
#include <linux/smp.h>
@@ -559,7 +560,8 @@ int do_syscall_trace_enter(struct pt_regs *regs)
559
560
return 0 ;
560
561
}
561
562
562
- if (regs -> syscall == NO_SYSCALL ) {
563
+ if (regs -> syscall == NO_SYSCALL ||
564
+ secure_computing () == -1 ) {
563
565
do_syscall_trace_leave (regs );
564
566
return 0 ;
565
567
}
You can’t perform that action at this time.
0 commit comments