From 4b3169c219c58d24c6f1ec1f7058f71e36bb2c3a Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Fri, 27 Feb 2009 23:25:54 -0800 Subject: [PATCH] --- yaml --- r: 131903 b: refs/heads/master c: 5b1017404aea6d2e552e991b3fd814d839e9cd67 h: refs/heads/master i: 131901: cc9fbc736652bcb00687fb11a3f3136f3979535f 131899: be7cf4ef60847bc76e28d9f8e8282e1fa1b8465e 131895: 6dc1111acf58df37d7933ef33e580b43c8e59794 131887: e07656fc29aaa41cc8c335db01ce60b2eddfa32b 131871: d543bd571f76682dc9ec7d675fe2f4b262826ab3 131839: 7aaa65476cbeec8e26dfb2fd6c01f9c642e8d5cd v: v3 --- [refs] | 2 +- trunk/arch/mips/include/asm/seccomp.h | 1 - trunk/arch/powerpc/include/asm/compat.h | 5 +++++ trunk/arch/powerpc/include/asm/seccomp.h | 4 ---- trunk/arch/sparc/include/asm/compat.h | 5 +++++ trunk/arch/sparc/include/asm/seccomp.h | 6 ------ trunk/arch/x86/include/asm/seccomp_32.h | 6 ------ trunk/arch/x86/include/asm/seccomp_64.h | 8 -------- trunk/kernel/seccomp.c | 7 ++++--- 9 files changed, 15 insertions(+), 29 deletions(-) diff --git a/[refs] b/[refs] index 615bddf0480b..5eec8a06c69e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ccbe495caa5e604b04d5a31d7459a6f6a76a756c +refs/heads/master: 5b1017404aea6d2e552e991b3fd814d839e9cd67 diff --git a/trunk/arch/mips/include/asm/seccomp.h b/trunk/arch/mips/include/asm/seccomp.h index 36ed44070256..a6772e9507f5 100644 --- a/trunk/arch/mips/include/asm/seccomp.h +++ b/trunk/arch/mips/include/asm/seccomp.h @@ -1,6 +1,5 @@ #ifndef __ASM_SECCOMP_H -#include #include #define __NR_seccomp_read __NR_read diff --git a/trunk/arch/powerpc/include/asm/compat.h b/trunk/arch/powerpc/include/asm/compat.h index d811a8cd7b58..4774c2f92232 100644 --- a/trunk/arch/powerpc/include/asm/compat.h +++ b/trunk/arch/powerpc/include/asm/compat.h @@ -210,5 +210,10 @@ struct compat_shmid64_ds { compat_ulong_t __unused6; }; +static inline int is_compat_task(void) +{ + return test_thread_flag(TIF_32BIT); +} + #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_COMPAT_H */ diff --git a/trunk/arch/powerpc/include/asm/seccomp.h b/trunk/arch/powerpc/include/asm/seccomp.h index 853765eb1f65..00c1d9133cfe 100644 --- a/trunk/arch/powerpc/include/asm/seccomp.h +++ b/trunk/arch/powerpc/include/asm/seccomp.h @@ -1,10 +1,6 @@ #ifndef _ASM_POWERPC_SECCOMP_H #define _ASM_POWERPC_SECCOMP_H -#ifdef __KERNEL__ -#include -#endif - #include #define __NR_seccomp_read __NR_read diff --git a/trunk/arch/sparc/include/asm/compat.h b/trunk/arch/sparc/include/asm/compat.h index f260b58f5ce9..0e706257918f 100644 --- a/trunk/arch/sparc/include/asm/compat.h +++ b/trunk/arch/sparc/include/asm/compat.h @@ -240,4 +240,9 @@ struct compat_shmid64_ds { unsigned int __unused2; }; +static inline int is_compat_task(void) +{ + return test_thread_flag(TIF_32BIT); +} + #endif /* _ASM_SPARC64_COMPAT_H */ diff --git a/trunk/arch/sparc/include/asm/seccomp.h b/trunk/arch/sparc/include/asm/seccomp.h index 7fcd9968192b..adca1bce41d4 100644 --- a/trunk/arch/sparc/include/asm/seccomp.h +++ b/trunk/arch/sparc/include/asm/seccomp.h @@ -1,11 +1,5 @@ #ifndef _ASM_SECCOMP_H -#include /* already defines TIF_32BIT */ - -#ifndef TIF_32BIT -#error "unexpected TIF_32BIT on sparc64" -#endif - #include #define __NR_seccomp_read __NR_read diff --git a/trunk/arch/x86/include/asm/seccomp_32.h b/trunk/arch/x86/include/asm/seccomp_32.h index a6ad87b352c4..b811d6f5780c 100644 --- a/trunk/arch/x86/include/asm/seccomp_32.h +++ b/trunk/arch/x86/include/asm/seccomp_32.h @@ -1,12 +1,6 @@ #ifndef _ASM_X86_SECCOMP_32_H #define _ASM_X86_SECCOMP_32_H -#include - -#ifdef TIF_32BIT -#error "unexpected TIF_32BIT on i386" -#endif - #include #define __NR_seccomp_read __NR_read diff --git a/trunk/arch/x86/include/asm/seccomp_64.h b/trunk/arch/x86/include/asm/seccomp_64.h index 4171bb794e9e..84ec1bd161a5 100644 --- a/trunk/arch/x86/include/asm/seccomp_64.h +++ b/trunk/arch/x86/include/asm/seccomp_64.h @@ -1,14 +1,6 @@ #ifndef _ASM_X86_SECCOMP_64_H #define _ASM_X86_SECCOMP_64_H -#include - -#ifdef TIF_32BIT -#error "unexpected TIF_32BIT on x86_64" -#else -#define TIF_32BIT TIF_IA32 -#endif - #include #include diff --git a/trunk/kernel/seccomp.c b/trunk/kernel/seccomp.c index ad64fcb731f2..57d4b13b631d 100644 --- a/trunk/kernel/seccomp.c +++ b/trunk/kernel/seccomp.c @@ -8,6 +8,7 @@ #include #include +#include /* #define SECCOMP_DEBUG 1 */ #define NR_SECCOMP_MODES 1 @@ -22,7 +23,7 @@ static int mode1_syscalls[] = { 0, /* null terminated */ }; -#ifdef TIF_32BIT +#ifdef CONFIG_COMPAT static int mode1_syscalls_32[] = { __NR_seccomp_read_32, __NR_seccomp_write_32, __NR_seccomp_exit_32, __NR_seccomp_sigreturn_32, 0, /* null terminated */ @@ -37,8 +38,8 @@ void __secure_computing(int this_syscall) switch (mode) { case 1: syscall = mode1_syscalls; -#ifdef TIF_32BIT - if (test_thread_flag(TIF_32BIT)) +#ifdef CONFIG_COMPAT + if (is_compat_task()) syscall = mode1_syscalls_32; #endif do {