switch to using asm-generic for seccomp.h
Subsystems (8)
v3 cover switch to using asm-generic for seccomp.h
Most architectures don't need to do much special for the strict-mode seccomp syscall entries. Remove the redundant headers and reduce the others.
---
v3:
- split patch series by architecture
- fix up architectures that need sigreturn overrides (ingo) v2:
- use Kbuild "generic-y" instead of explicit #include lines (sfr)
PATCH v3 1/8 seccomp: allow COMPAT sigreturn overrides
Some architectures may need to override the compat sigreturn definition, as is already possible in the non-compat case.
--- include/asm-generic/seccomp.h | 2 ++ 1 file changed, 2 insertions(+)
include/asm-generic/seccomp.h +2 -0
@@ -17,7 +17,9 @@#define __NR_seccomp_read_32 __NR_read#define __NR_seccomp_write_32 __NR_write#define __NR_seccomp_exit_32 __NR_exit +#ifndef __NR_seccomp_sigreturn_32#define __NR_seccomp_sigreturn_32 __NR_rt_sigreturn +#endif #endif /* CONFIG_COMPAT && ! already defined */ #define __NR_seccomp_read __NR_read
Signature · 1 line
1.9.1
PATCH v3 2/8 arm: use asm-generic for seccomp.h
In reply to Kees CookSwitch to using the newly created asm-generic/seccomp.h for the seccomp strict mode syscall definitions. Definitions were identical.
--- arch/arm/include/asm/Kbuild | 1 + arch/arm/include/asm/seccomp.h | 11 ----------- 2 files changed, 1 insertion(+), 11 deletions(-) delete mode 100644 arch/arm/include/asm/seccomp.h
arch/arm/include/asm/Kbuild +1 -0
@@ -22,6 +22,7 @@ generic-y += preempt.h generic-y += resource.h generic-y += rwsem.h generic-y += scatterlist.h +generic-y += seccomp.h generic-y += sections.h generic-y += segment.h generic-y += sembuf.h
arch/arm/include/asm/seccomp.h deleted +0 -11
@@ -1,11 +0,0 @@ -#ifndef _ASM_ARM_SECCOMP_H -#define _ASM_ARM_SECCOMP_H - -#include <linux/unistd.h> - -#define __NR_seccomp_read __NR_read -#define __NR_seccomp_write __NR_write -#define __NR_seccomp_exit __NR_exit -#define __NR_seccomp_sigreturn __NR_rt_sigreturn - -#endif /* _ASM_ARM_SECCOMP_H */
Signature · 1 line
1.9.1
PATCH v3 3/8 microblaze: use asm-generic for seccomp.h
In reply to Kees CookSwitch to using the newly created asm-generic/seccomp.h for the seccomp strict mode syscall definitions. Since microblaze is 32-bit, the COMPAT seccomp defines are unused and can be dropped. The obsolete sigreturn for seccomp strict mode is retained as an override. Remaining definitions are identical.
--- arch/microblaze/include/asm/seccomp.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
arch/microblaze/include/asm/seccomp.h +1 -7
@@ -3,14 +3,8 @@#include <linux/unistd.h> -#define __NR_seccomp_read __NR_read -#define __NR_seccomp_write __NR_write -#define __NR_seccomp_exit __NR_exit#define __NR_seccomp_sigreturn __NR_sigreturn -#define __NR_seccomp_read_32 __NR_read -#define __NR_seccomp_write_32 __NR_write -#define __NR_seccomp_exit_32 __NR_exit -#define __NR_seccomp_sigreturn_32 __NR_sigreturn +#include <asm-generic/seccomp.h> #endif /* _ASM_MICROBLAZE_SECCOMP_H */
Signature · 1 line
1.9.1
PATCH v3 4/8 mips: switch to using asm-generic for seccomp.h
In reply to Kees CookSwitch to using the newly created asm-generic/seccomp.h for the seccomp strict mode syscall definitions. COMPAT definitions retain their overrides and the remaining definitions were identical.
--- arch/mips/include/asm/seccomp.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
arch/mips/include/asm/seccomp.h +2 -5
@@ -2,11 +2,6 @@#include <linux/unistd.h> -#define __NR_seccomp_read __NR_read -#define __NR_seccomp_write __NR_write -#define __NR_seccomp_exit __NR_exit -#define __NR_seccomp_sigreturn __NR_rt_sigreturn -/* * Kludge alert: *
@@ -29,4 +24,6 @@#endif /* CONFIG_MIPS32_O32 */ +#include <asm-generic/seccomp.h> +#endif /* __ASM_SECCOMP_H */
Signature · 1 line
1.9.1
PATCH v3 5/8 parisc: switch to using asm-generic for seccomp.h
In reply to Kees CookSwitch to using the newly created asm-generic/seccomp.h for the seccomp strict mode syscall definitions. Definitions were identical.
--- arch/parisc/include/asm/Kbuild | 1 + arch/parisc/include/asm/seccomp.h | 16 ---------------- 2 files changed, 1 insertion(+), 16 deletions(-) delete mode 100644 arch/parisc/include/asm/seccomp.h
arch/parisc/include/asm/Kbuild +1 -0
@@ -20,6 +20,7 @@ generic-y += param.h generic-y += percpu.h generic-y += poll.h generic-y += preempt.h +generic-y += seccomp.h generic-y += segment.h generic-y += topology.h generic-y += trace_clock.h
arch/parisc/include/asm/seccomp.h deleted +0 -16
@@ -1,16 +0,0 @@ -#ifndef _ASM_PARISC_SECCOMP_H -#define _ASM_PARISC_SECCOMP_H - -#include <linux/unistd.h> - -#define __NR_seccomp_read __NR_read -#define __NR_seccomp_write __NR_write -#define __NR_seccomp_exit __NR_exit -#define __NR_seccomp_sigreturn __NR_rt_sigreturn - -#define __NR_seccomp_read_32 __NR_read -#define __NR_seccomp_write_32 __NR_write -#define __NR_seccomp_exit_32 __NR_exit -#define __NR_seccomp_sigreturn_32 __NR_rt_sigreturn - -#endif /* _ASM_PARISC_SECCOMP_H */
Signature · 1 line
1.9.1
PATCH v3 6/8 powerpc: switch to using asm-generic for seccomp.h
In reply to Kees CookSwitch to using the newly created asm-generic/seccomp.h for the seccomp strict mode syscall definitions. The obsolete sigreturn in COMPAT mode is retained as an override. Remaining definitions are identical, though they incorrectly appeared in uapi, which has been corrected.
--- arch/powerpc/include/asm/seccomp.h | 10 ++++++++++ arch/powerpc/include/uapi/asm/Kbuild | 1 - arch/powerpc/include/uapi/asm/seccomp.h | 16 ---------------- 3 files changed, 10 insertions(+), 17 deletions(-) create mode 100644 arch/powerpc/include/asm/seccomp.h delete mode 100644 arch/powerpc/include/uapi/asm/seccomp.h
arch/powerpc/include/asm/seccomp.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef _ASM_POWERPC_SECCOMP_H +#define _ASM_POWERPC_SECCOMP_H + +#include <linux/unistd.h> + +#define __NR_seccomp_sigreturn_32 __NR_sigreturn + +#include <asm-generic/seccomp.h> + +#endif /* _ASM_POWERPC_SECCOMP_H */
arch/powerpc/include/uapi/asm/Kbuild +0 -1
@@ -25,7 +25,6 @@ header-y += posix_types.h header-y += ps3fb.h header-y += ptrace.h header-y += resource.h -header-y += seccomp.h header-y += sembuf.h header-y += setup.h header-y += shmbuf.h
arch/powerpc/include/uapi/asm/seccomp.h deleted +0 -14
@@ -1,16 +0,0 @@ -#ifndef _ASM_POWERPC_SECCOMP_H -#define _ASM_POWERPC_SECCOMP_H - -#include <linux/unistd.h> - -#define __NR_seccomp_read __NR_read -#define __NR_seccomp_write __NR_write -#define __NR_seccomp_exit __NR_exit -#define __NR_seccomp_sigreturn __NR_rt_sigreturn - -#define __NR_seccomp_read_32 __NR_read -#define __NR_seccomp_write_32 __NR_write -#define __NR_seccomp_exit_32 __NR_exit -#define __NR_seccomp_sigreturn_32 __NR_sigreturn
PATCH v3 7/8 sparc: switch to using asm-generic for seccomp.h
In reply to Kees CookSwitch to using the newly created asm-generic/seccomp.h for the seccomp strict mode syscall definitions. The obsolete sigreturn in COMPAT mode is retained as an override. Remaining definitions are identical. Also corrected missing #define for header reinclusion protection.
--- arch/sparc/include/asm/seccomp.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
arch/sparc/include/asm/seccomp.h +3 -8
@@ -1,15 +1,10 @@#ifndef _ASM_SECCOMP_H +#define _ASM_SECCOMP_H#include <linux/unistd.h> -#define __NR_seccomp_read __NR_read -#define __NR_seccomp_write __NR_write -#define __NR_seccomp_exit __NR_exit -#define __NR_seccomp_sigreturn __NR_rt_sigreturn - -#define __NR_seccomp_read_32 __NR_read -#define __NR_seccomp_write_32 __NR_write -#define __NR_seccomp_exit_32 __NR_exit#define __NR_seccomp_sigreturn_32 __NR_sigreturn +#include <asm-generic/seccomp.h> +#endif /* _ASM_SECCOMP_H */
Signature · 1 line
1.9.1
PATCH v3 8/8 x86: switch to using asm-generic for seccomp.h
In reply to Kees CookSwitch to using the newly created asm-generic/seccomp.h for the seccomp strict mode syscall definitions. The obsolete sigreturn syscall override is retained in 32-bit mode, and the ia32 syscall overrides are used in the compat case. Remaining definitions were identical.
--- arch/x86/include/asm/seccomp.h | 21 ++++++++++++++++++--- arch/x86/include/asm/seccomp_32.h | 11 ----------- arch/x86/include/asm/seccomp_64.h | 17 ----------------- 3 files changed, 18 insertions(+), 31 deletions(-) delete mode 100644 arch/x86/include/asm/seccomp_32.h delete mode 100644 arch/x86/include/asm/seccomp_64.h
arch/x86/include/asm/seccomp.h +18 -3
@@ -1,5 +1,20 @@ +#ifndef _ASM_X86_SECCOMP_H +#define _ASM_X86_SECCOMP_H + +#include <asm/unistd.h> +#ifdef CONFIG_X86_32 -# include <asm/seccomp_32.h> -#else -# include <asm/seccomp_64.h> +#define __NR_seccomp_sigreturn __NR_sigreturn#endif + +#ifdef CONFIG_COMPAT +#include <asm/ia32_unistd.h> +#define __NR_seccomp_read_32 __NR_ia32_read +#define __NR_seccomp_write_32 __NR_ia32_write +#define __NR_seccomp_exit_32 __NR_ia32_exit +#define __NR_seccomp_sigreturn_32 __NR_ia32_sigreturn +#endif + +#include <asm-generic/seccomp.h> + +#endif /* _ASM_X86_SECCOMP_H */
arch/x86/include/asm/seccomp_32.h deleted +0 -11
@@ -1,11 +0,0 @@ -#ifndef _ASM_X86_SECCOMP_32_H -#define _ASM_X86_SECCOMP_32_H - -#include <linux/unistd.h> - -#define __NR_seccomp_read __NR_read -#define __NR_seccomp_write __NR_write -#define __NR_seccomp_exit __NR_exit -#define __NR_seccomp_sigreturn __NR_sigreturn - -#endif /* _ASM_X86_SECCOMP_32_H */
arch/x86/include/asm/seccomp_64.h deleted +0 -17
@@ -1,17 +0,0 @@ -#ifndef _ASM_X86_SECCOMP_64_H -#define _ASM_X86_SECCOMP_64_H - -#include <linux/unistd.h> -#include <asm/ia32_unistd.h> - -#define __NR_seccomp_read __NR_read -#define __NR_seccomp_write __NR_write -#define __NR_seccomp_exit __NR_exit -#define __NR_seccomp_sigreturn __NR_rt_sigreturn - -#define __NR_seccomp_read_32 __NR_ia32_read -#define __NR_seccomp_write_32 __NR_ia32_write -#define __NR_seccomp_exit_32 __NR_ia32_exit -#define __NR_seccomp_sigreturn_32 __NR_ia32_sigreturn - -#endif /* _ASM_X86_SECCOMP_64_H */
Signature · 1 line
1.9.1
Re: [PATCH v3 8/8] x86: switch to using asm-generic for seccomp.h
Quoted 7 lines · Kees Cook
Switch to using the newly created
asm-generic/seccomp.hfor the seccomp strict mode syscall definitions. The obsolete sigreturn syscall override is retained in 32-bit mode, and the ia32 syscall overrides are used in the compat case. Remaining definitions were identical.Signed-off-by Kees Cook <[email protected]>
Thanks,
Ingo
Quoted 5 lines · Kees Cook
Most architectures don't need to do much special for the strict-mode seccomp syscall entries. Remove the redundant headers and reduce the others.
Signed-off-by Kees Cook <[email protected]>
Hi Andrew,
Just a quick ping: are you able to pick up this series, or should I try to get this in on a per-arch basis?
Thanks!
-Kees
Quoted 7 lines
---
v3:
- split patch series by architecture
- fix up architectures that need sigreturn overrides (ingo) v2:
- useKbuild"generic-y" instead of explicit #include lines (sfr)
Signature · 2 lines
Kees Cook Chrome OS Security