seccomp: switch to using asm-generic for seccomp.h
Subsystems (9)
PATCH 1/1 seccomp: switch to using asm-generic for seccomp.h
Most architectures don't need to do anything special for the strict seccomp syscall entries. Remove the redundant headers and reduce the others.
--- arch/arm/include/asm/seccomp.h | 12 +----------- arch/microblaze/include/asm/seccomp.h | 17 +---------------- arch/mips/include/asm/seccomp.h | 7 ++----- arch/parisc/include/asm/seccomp.h | 17 +---------------- arch/powerpc/include/asm/seccomp.h | 1 + arch/powerpc/include/uapi/asm/Kbuild | 1 - arch/powerpc/include/uapi/asm/seccomp.h | 16 ---------------- arch/s390/include/asm/seccomp.h | 17 +---------------- arch/sh/include/asm/seccomp.h | 11 +---------- arch/sparc/include/asm/seccomp.h | 16 +--------------- arch/x86/include/asm/seccomp.h | 21 ++++++++++++++++++--- arch/x86/include/asm/seccomp_32.h | 11 ----------- arch/x86/include/asm/seccomp_64.h | 17 ----------------- 13 files changed, 27 insertions(+), 137 deletions(-) create mode 100644 arch/powerpc/include/asm/seccomp.h delete mode 100644 arch/powerpc/include/uapi/asm/seccomp.h delete mode 100644 arch/x86/include/asm/seccomp_32.h delete mode 100644 arch/x86/include/asm/seccomp_64.h
arch/arm/include/asm/seccomp.h +1 -11
@@ -1,11 +1 @@ -#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 */ +#include <asm-generic/seccomp.h>
arch/microblaze/include/asm/seccomp.h +1 -16
@@ -1,16 +1 @@ -#ifndef _ASM_MICROBLAZE_SECCOMP_H -#define _ASM_MICROBLAZE_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_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 - -#endif /* _ASM_MICROBLAZE_SECCOMP_H */ +#include <asm-generic/seccomp.h>
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 */
arch/parisc/include/asm/seccomp.h +1 -16
@@ -1,16 +1 @@ -#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 */ +#include <asm-generic/seccomp.h>
arch/powerpc/include/asm/seccomp.h new file +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/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 -16
@@ -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 - -#endif /* _ASM_POWERPC_SECCOMP_H */
arch/s390/include/asm/seccomp.h +1 -16
@@ -1,16 +1 @@ -#ifndef _ASM_S390_SECCOMP_H -#define _ASM_S390_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_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 - -#endif /* _ASM_S390_SECCOMP_H */ +#include <asm-generic/seccomp.h>
arch/sh/include/asm/seccomp.h +1 -10
@@ -1,10 +1 @@ -#ifndef __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 - -#endif /* __ASM_SECCOMP_H */ +#include <asm-generic/seccomp.h>
arch/sparc/include/asm/seccomp.h +1 -15
@@ -1,15 +1 @@ -#ifndef _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 - -#endif /* _ASM_SECCOMP_H */ +#include <asm-generic/seccomp.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_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 +#ifdef CONFIG_X86_32 -# include <asm/seccomp_32.h> -#else -# include <asm/seccomp_64.h> +#define __NR_seccomp_sigreturn __NR_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 · 6 lines
1.9.1 -- Kees Cook Chrome OS Security
Hi Kees,
Quoted 8 lines · On Fri, 27 Feb 2015 16:52:29 -0800 Kees Cook <[email protected]> wrote:
arch/arm/include/asm/seccomp.h +0
-2@@ -1,11 +1 @@ -#ifndef _ASM_ARM_SECCOMP_H -#define _ASM_ARM_SECCOMP_H
arch/arm/include/asm/seccomp.h line 1
Quoted 10 lines
arch/arm/include/asm/seccomp.h +1
-9- -#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 */ +#include <asm-generic/seccomp.h>
I think that these cases (where you replace the file by a stub that just include <asm-generic/seccomp.h>) can be replaced by removing the file completely and adding
generic-y = seccomp.h
to <ARCH>/include/asm/Kbuild
Signature · 9 lines
Cheers, Stephen Rothwell sfr at canb.auug.org.au -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150228/9e5ceab2/attachment.sig>
Quoted 26 lines · Stephen Rothwell
Hi Kees,
Quoted 8 lines · On Fri, 27 Feb 2015 16:52:29 -0800 Kees Cook <[email protected]> wrote:
arch/arm/include/asm/seccomp.h +0
-2@@ -1,11 +1 @@ -#ifndef _ASM_ARM_SECCOMP_H -#define _ASM_ARM_SECCOMP_Harch/arm/include/asm/seccomp.h line 1
Quoted 10 lines
arch/arm/include/asm/seccomp.h +1
-9- -#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 */ +#include <asm-generic/seccomp.h> I think that these cases (where you replace the file by a stub that just include <
asm-generic/seccomp.h>) can be replaced by removing the file completely and adding
Quoted 3 lines
generic-y =
seccomp.hto <ARCH>/include/asm/Kbuild
Ah-ha! I thought total removal was possible, but I lacked the Kbuild piece. There are a lot of arch/ headers that are just the one line. Maybe I should send a another patch to clean up those?
-Kees
Signature · 2 lines
Kees Cook Chrome OS Security