diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2014-09-07 16:05:05 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2014-10-08 05:17:42 -0400 |
commit | 0e6d3112a4e95d55cf6dca88f298d5f4b8f29bd1 (patch) | |
tree | 586843c4369dfd16f9db8df6912b6956488b910f | |
parent | 8c7aa698baca5e8f1ba9edb68081f1e7a1abf455 (diff) |
x86: Reject x32 executables if x32 ABI not supported
It is currently possible to execve() an x32 executable on an x86_64
kernel that has only ia32 compat enabled. However all its syscalls
will fail, even _exit(). This usually causes it to segfault.
Change the ELF compat architecture check so that x32 executables are
rejected if we don't support the x32 ABI.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Link: http://lkml.kernel.org/r/1410120305.6822.9.camel@decadent.org.uk
Cc: stable@vger.kernel.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | arch/x86/include/asm/elf.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h index 1a055c81d864..ca3347a9dab5 100644 --- a/arch/x86/include/asm/elf.h +++ b/arch/x86/include/asm/elf.h | |||
@@ -160,8 +160,9 @@ do { \ | |||
160 | #define elf_check_arch(x) \ | 160 | #define elf_check_arch(x) \ |
161 | ((x)->e_machine == EM_X86_64) | 161 | ((x)->e_machine == EM_X86_64) |
162 | 162 | ||
163 | #define compat_elf_check_arch(x) \ | 163 | #define compat_elf_check_arch(x) \ |
164 | (elf_check_arch_ia32(x) || (x)->e_machine == EM_X86_64) | 164 | (elf_check_arch_ia32(x) || \ |
165 | (IS_ENABLED(CONFIG_X86_X32_ABI) && (x)->e_machine == EM_X86_64)) | ||
165 | 166 | ||
166 | #if __USER32_DS != __USER_DS | 167 | #if __USER32_DS != __USER_DS |
167 | # error "The following code assumes __USER32_DS == __USER_DS" | 168 | # error "The following code assumes __USER32_DS == __USER_DS" |