Skip to content

Commit 8b05418

Browse files
committed
Merge tag 'seccomp-v5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull seccomp updates from Kees Cook: "The bulk of the changes are with the seccomp selftests to accommodate some powerpc-specific behavioral characteristics. Additional cleanups, fixes, and improvements are also included: - heavily refactor seccomp selftests (and clone3 selftests dependency) to fix powerpc (Kees Cook, Thadeu Lima de Souza Cascardo) - fix style issue in selftests (Zou Wei) - upgrade "unknown action" from KILL_THREAD to KILL_PROCESS (Rich Felker) - replace task_pt_regs(current) with current_pt_regs() (Denis Efremov) - fix corner-case race in USER_NOTIF (Jann Horn) - make CONFIG_SECCOMP no longer per-arch (YiFei Zhu)" * tag 'seccomp-v5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: (23 commits) seccomp: Make duplicate listener detection non-racy seccomp: Move config option SECCOMP to arch/Kconfig selftests/clone3: Avoid OS-defined clone_args selftests/seccomp: powerpc: Set syscall return during ptrace syscall exit selftests/seccomp: Allow syscall nr and ret value to be set separately selftests/seccomp: Record syscall during ptrace entry selftests/seccomp: powerpc: Fix seccomp return value testing selftests/seccomp: Remove SYSCALL_NUM_RET_SHARE_REG in favor of SYSCALL_RET_SET selftests/seccomp: Avoid redundant register flushes selftests/seccomp: Convert REGSET calls into ARCH_GETREG/ARCH_SETREG selftests/seccomp: Convert HAVE_GETREG into ARCH_GETREG/ARCH_SETREG selftests/seccomp: Remove syscall setting #ifdefs selftests/seccomp: mips: Remove O32-specific macro selftests/seccomp: arm64: Define SYSCALL_NUM_SET macro selftests/seccomp: arm: Define SYSCALL_NUM_SET macro selftests/seccomp: mips: Define SYSCALL_NUM_SET macro selftests/seccomp: Provide generic syscall setting macro selftests/seccomp: Refactor arch register macros to avoid xtensa special case selftests/seccomp: Use __NR_mknodat instead of __NR_mknod selftests/seccomp: Use bitwise instead of arithmetic operator for flags ...
2 parents 7b54081 + dfe719f commit 8b05418

23 files changed

Lines changed: 397 additions & 437 deletions

File tree

arch/Kconfig

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,10 +450,23 @@ config ARCH_WANT_OLD_COMPAT_IPC
450450
select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
451451
bool
452452

453+
config HAVE_ARCH_SECCOMP
454+
bool
455+
help
456+
An arch should select this symbol to support seccomp mode 1 (the fixed
457+
syscall policy), and must provide an overrides for __NR_seccomp_sigreturn,
458+
and compat syscalls if the asm-generic/seccomp.h defaults need adjustment:
459+
- __NR_seccomp_read_32
460+
- __NR_seccomp_write_32
461+
- __NR_seccomp_exit_32
462+
- __NR_seccomp_sigreturn_32
463+
453464
config HAVE_ARCH_SECCOMP_FILTER
454465
bool
466+
select HAVE_ARCH_SECCOMP
455467
help
456468
An arch should select this symbol if it provides all of these things:
469+
- all the requirements for HAVE_ARCH_SECCOMP
457470
- syscall_get_arch()
458471
- syscall_get_arguments()
459472
- syscall_rollback()
@@ -464,6 +477,23 @@ config HAVE_ARCH_SECCOMP_FILTER
464477
results in the system call being skipped immediately.
465478
- seccomp syscall wired up
466479

480+
config SECCOMP
481+
prompt "Enable seccomp to safely execute untrusted bytecode"
482+
def_bool y
483+
depends on HAVE_ARCH_SECCOMP
484+
help
485+
This kernel feature is useful for number crunching applications
486+
that may need to handle untrusted bytecode during their
487+
execution. By using pipes or other transports made available
488+
to the process as file descriptors supporting the read/write
489+
syscalls, it's possible to isolate those applications in their
490+
own address space using seccomp. Once seccomp is enabled via
491+
prctl(PR_SET_SECCOMP) or the seccomp() syscall, it cannot be
492+
disabled and the task is only allowed to execute a few safe
493+
syscalls defined by each seccomp mode.
494+
495+
If unsure, say Y.
496+
467497
config SECCOMP_FILTER
468498
def_bool y
469499
depends on HAVE_ARCH_SECCOMP_FILTER && SECCOMP && NET

arch/arm/Kconfig

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ config ARM
6868
select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
6969
select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU
7070
select HAVE_ARCH_MMAP_RND_BITS if MMU
71+
select HAVE_ARCH_SECCOMP
7172
select HAVE_ARCH_SECCOMP_FILTER if AEABI && !OABI_COMPAT
7273
select HAVE_ARCH_THREAD_STRUCT_WHITELIST
7374
select HAVE_ARCH_TRACEHOOK
@@ -1618,20 +1619,6 @@ config UACCESS_WITH_MEMCPY
16181619
However, if the CPU data cache is using a write-allocate mode,
16191620
this option is unlikely to provide any performance gain.
16201621

1621-
config SECCOMP
1622-
bool
1623-
prompt "Enable seccomp to safely compute untrusted bytecode"
1624-
help
1625-
This kernel feature is useful for number crunching applications
1626-
that may need to compute untrusted bytecode during their
1627-
execution. By using pipes or other transports made available to
1628-
the process as file descriptors supporting the read/write
1629-
syscalls, it's possible to isolate those applications in
1630-
their own address space using seccomp. Once seccomp is
1631-
enabled via prctl(PR_SET_SECCOMP), it cannot be disabled
1632-
and the task is only allowed to execute a few safe syscalls
1633-
defined by each seccomp mode.
1634-
16351622
config PARAVIRT
16361623
bool "Enable paravirtualization code"
16371624
help

arch/arm64/Kconfig

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,19 +1041,6 @@ config ARCH_ENABLE_SPLIT_PMD_PTLOCK
10411041
config CC_HAVE_SHADOW_CALL_STACK
10421042
def_bool $(cc-option, -fsanitize=shadow-call-stack -ffixed-x18)
10431043

1044-
config SECCOMP
1045-
bool "Enable seccomp to safely compute untrusted bytecode"
1046-
help
1047-
This kernel feature is useful for number crunching applications
1048-
that may need to compute untrusted bytecode during their
1049-
execution. By using pipes or other transports made available to
1050-
the process as file descriptors supporting the read/write
1051-
syscalls, it's possible to isolate those applications in
1052-
their own address space using seccomp. Once seccomp is
1053-
enabled via prctl(PR_SET_SECCOMP), it cannot be disabled
1054-
and the task is only allowed to execute a few safe syscalls
1055-
defined by each seccomp mode.
1056-
10571044
config PARAVIRT
10581045
bool "Enable paravirtualization code"
10591046
help

arch/csky/Kconfig

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -309,16 +309,3 @@ endmenu
309309
source "arch/csky/Kconfig.platforms"
310310

311311
source "kernel/Kconfig.hz"
312-
313-
config SECCOMP
314-
bool "Enable seccomp to safely compute untrusted bytecode"
315-
help
316-
This kernel feature is useful for number crunching applications
317-
that may need to compute untrusted bytecode during their
318-
execution. By using pipes or other transports made available to
319-
the process as file descriptors supporting the read/write
320-
syscalls, it's possible to isolate those applications in
321-
their own address space using seccomp. Once seccomp is
322-
enabled via prctl(PR_SET_SECCOMP), it cannot be disabled
323-
and the task is only allowed to execute a few safe syscalls
324-
defined by each seccomp mode.

arch/microblaze/Kconfig

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ config MICROBLAZE
2626
select GENERIC_SCHED_CLOCK
2727
select HAVE_ARCH_HASH
2828
select HAVE_ARCH_KGDB
29+
select HAVE_ARCH_SECCOMP
2930
select HAVE_DEBUG_KMEMLEAK
3031
select HAVE_DMA_CONTIGUOUS
3132
select HAVE_DYNAMIC_FTRACE
@@ -120,23 +121,6 @@ config CMDLINE_FORCE
120121
Set this to have arguments from the default kernel command string
121122
override those passed by the boot loader.
122123

123-
config SECCOMP
124-
bool "Enable seccomp to safely compute untrusted bytecode"
125-
depends on PROC_FS
126-
default y
127-
help
128-
This kernel feature is useful for number crunching applications
129-
that may need to compute untrusted bytecode during their
130-
execution. By using pipes or other transports made available to
131-
the process as file descriptors supporting the read/write
132-
syscalls, it's possible to isolate those applications in
133-
their own address space using seccomp. Once seccomp is
134-
enabled via /proc/<pid>/seccomp, it cannot be disabled
135-
and the task is only allowed to execute a few safe syscalls
136-
defined by each seccomp mode.
137-
138-
If unsure, say Y. Only embedded should say N here.
139-
140124
endmenu
141125

142126
menu "Kernel features"

arch/mips/Kconfig

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3006,23 +3006,6 @@ config PHYSICAL_START
30063006
specified in the "crashkernel=YM@XM" command line boot parameter
30073007
passed to the panic-ed kernel).
30083008

3009-
config SECCOMP
3010-
bool "Enable seccomp to safely compute untrusted bytecode"
3011-
depends on PROC_FS
3012-
default y
3013-
help
3014-
This kernel feature is useful for number crunching applications
3015-
that may need to compute untrusted bytecode during their
3016-
execution. By using pipes or other transports made available to
3017-
the process as file descriptors supporting the read/write
3018-
syscalls, it's possible to isolate those applications in
3019-
their own address space using seccomp. Once seccomp is
3020-
enabled via /proc/<pid>/seccomp, it cannot be disabled
3021-
and the task is only allowed to execute a few safe syscalls
3022-
defined by each seccomp mode.
3023-
3024-
If unsure, say Y. Only embedded should say N here.
3025-
30263009
config MIPS_O32_FP64_SUPPORT
30273010
bool "Support for O32 binaries using 64-bit FP" if !CPU_MIPSR6
30283011
depends on 32BIT || MIPS32_O32

arch/parisc/Kconfig

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -378,19 +378,3 @@ endmenu
378378

379379

380380
source "drivers/parisc/Kconfig"
381-
382-
config SECCOMP
383-
def_bool y
384-
prompt "Enable seccomp to safely compute untrusted bytecode"
385-
help
386-
This kernel feature is useful for number crunching applications
387-
that may need to compute untrusted bytecode during their
388-
execution. By using pipes or other transports made available to
389-
the process as file descriptors supporting the read/write
390-
syscalls, it's possible to isolate those applications in
391-
their own address space using seccomp. Once seccomp is
392-
enabled via prctl(PR_SET_SECCOMP), it cannot be disabled
393-
and the task is only allowed to execute a few safe syscalls
394-
defined by each seccomp mode.
395-
396-
If unsure, say Y. Only embedded should say N here.

arch/powerpc/Kconfig

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -946,23 +946,6 @@ config ARCH_WANTS_FREEZER_CONTROL
946946

947947
source "kernel/power/Kconfig"
948948

949-
config SECCOMP
950-
bool "Enable seccomp to safely compute untrusted bytecode"
951-
depends on PROC_FS
952-
default y
953-
help
954-
This kernel feature is useful for number crunching applications
955-
that may need to compute untrusted bytecode during their
956-
execution. By using pipes or other transports made available to
957-
the process as file descriptors supporting the read/write
958-
syscalls, it's possible to isolate those applications in
959-
their own address space using seccomp. Once seccomp is
960-
enabled via /proc/<pid>/seccomp, it cannot be disabled
961-
and the task is only allowed to execute a few safe syscalls
962-
defined by each seccomp mode.
963-
964-
If unsure, say Y. Only embedded should say N here.
965-
966949
config PPC_MEM_KEYS
967950
prompt "PowerPC Memory Protection Keys"
968951
def_bool y

arch/riscv/Kconfig

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -334,19 +334,6 @@ menu "Kernel features"
334334

335335
source "kernel/Kconfig.hz"
336336

337-
config SECCOMP
338-
bool "Enable seccomp to safely compute untrusted bytecode"
339-
help
340-
This kernel feature is useful for number crunching applications
341-
that may need to compute untrusted bytecode during their
342-
execution. By using pipes or other transports made available to
343-
the process as file descriptors supporting the read/write
344-
syscalls, it's possible to isolate those applications in
345-
their own address space using seccomp. Once seccomp is
346-
enabled via prctl(PR_SET_SECCOMP), it cannot be disabled
347-
and the task is only allowed to execute a few safe syscalls
348-
defined by each seccomp mode.
349-
350337
config RISCV_SBI_V01
351338
bool "SBI v0.1 support"
352339
default y

arch/s390/Kconfig

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -792,23 +792,6 @@ config CRASH_DUMP
792792

793793
endmenu
794794

795-
config SECCOMP
796-
def_bool y
797-
prompt "Enable seccomp to safely compute untrusted bytecode"
798-
depends on PROC_FS
799-
help
800-
This kernel feature is useful for number crunching applications
801-
that may need to compute untrusted bytecode during their
802-
execution. By using pipes or other transports made available to
803-
the process as file descriptors supporting the read/write
804-
syscalls, it's possible to isolate those applications in
805-
their own address space using seccomp. Once seccomp is
806-
enabled via /proc/<pid>/seccomp, it cannot be disabled
807-
and the task is only allowed to execute a few safe syscalls
808-
defined by each seccomp mode.
809-
810-
If unsure, say Y.
811-
812795
config CCW
813796
def_bool y
814797

0 commit comments

Comments
 (0)