aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2013-07-25 11:44:48 +0100
committerSteven Rostedt <rostedt@goodmis.org>2013-09-13 11:39:57 -0400
commit2c6dcb41ceac69aeb8cc6560a71c0b24401b1897 (patch)
treefdbd3ca6cc375daf99a97ae4bba777789370c341
parentee3edff55189ec823674f6d99e5a87c6ab483c03 (diff)
ARM: 7791/1: a.out: remove partial a.out support
[ Merge conflict with 3.8.13.7-rt17 removed the deletion of HAVE_AOUT from arch/arm/Kconfig. Reapply the stable patch to that file. ] a.out support on ARM requires that argc, argv and envp are passed in r0-r2 respectively, which requires hacking load_aout_binary to prevent argc being clobbered by the return code. Whilst mainline kernels do set the registers up in start_thread, the aout loader has never carried the hack in mainline. Initialising the registers in this way actually goes against the libc expectations for ELF binaries, where argc, argv and envp are passed on the stack, with r0 being used to hold a pointer to an exit function for cleaning up after the dynamic linker if required. If the pointer is NULL, then it is ignored. When execing an ELF binary, Linux currently zeroes r0, then sets it to argc and then finally clobbers it with the return value of the execve syscall, so we actually end up with: r0 = 0 stack[0] = argc r1 = stack[1] = argv r2 = stack[2] = envp libc treats r1 and r2 as undefined. The clobbering of r0 by sys_execve works for user-spawned threads, but when executing an ELF binary from a kernel thread (via call_usermodehelper), the execve is performed on the ret_from_fork path, which restores r0 from the saved pt_regs, resulting in argc being presented to the C library. This has horrible consequences when the application exits, since we have an exit function registered using argc, resulting in a jump to hyperspace. This patch solves the problem by removing the partial a.out support from arch/arm/ altogether. Cc: <stable@vger.kernel.org> Cc: Ashish Sangwan <ashishsangwan2@gmail.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/Kconfig1
1 files changed, 0 insertions, 1 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e3c0792c1a89..2bde74ad8a35 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -18,7 +18,6 @@ config ARM
select GENERIC_STRNLEN_USER
select HARDIRQS_SW_RESEND
select IRQ_FORCED_THREADING
- select HAVE_AOUT
select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
select HAVE_ARCH_KGDB
select HAVE_ARCH_SECCOMP_FILTER