freebsd-dev/sys/arm
Ed Schouten 814629dd64 Don't let cpu_set_syscall_retval() clobber exec_setregs().
Upon successful completion, the execve() system call invokes
exec_setregs() to initialize the registers of the initial thread of the
newly executed process. What is weird is that when execve() returns, it
still goes through the normal system call return path, clobbering the
registers with the system call's return value (td->td_retval).

Though this doesn't seem to be problematic for x86 most of the times (as
the value of eax/rax doesn't matter upon startup), this can be pretty
frustrating for architectures where function argument and return
registers overlap (e.g., ARM). On these systems, exec_setregs() also
needs to initialize td_retval.

Even worse are architectures where cpu_set_syscall_retval() sets
registers to values not derived from td_retval. On these architectures,
there is no way cpu_set_syscall_retval() can set registers to the way it
wants them to be upon the start of execution.

To get rid of this madness, let sys_execve() return EJUSTRETURN. This
will cause cpu_set_syscall_retval() to leave registers intact. This
makes process execution easier to understand. It also eliminates the
difference between execution of the initial process and successive ones.
The initial call to sys_execve() is not performed through a system call
context.

Reviewed by:	kib, jhibbits
Differential Revision:	https://reviews.freebsd.org/D13180
2017-11-24 07:35:08 +00:00
..
allwinner Add ccu compat string for Allwinner a83t 2017-11-24 02:39:38 +00:00
altera/socfpga Tag all armv7 kernels as such in their machine config line. 2017-10-05 23:01:50 +00:00
amlogic/aml8726 Tag all armv7 kernels as such in their machine config line. 2017-10-05 23:01:50 +00:00
annapurna/alpine Tag all armv7 kernels as such in their machine config line. 2017-10-05 23:01:50 +00:00
arm Ensure we check the program state set in the trap frame on arm and arm64. 2017-11-23 17:40:40 +00:00
at91 Defer attaching and probing iicbus and its children until interrupts are 2017-09-13 16:54:27 +00:00
broadcom/bcm2835 arm: rpi2: Fix cpufreq(4) 2017-11-13 18:53:41 +00:00
cavium/cns11xx Allow setting access-width for UART registers. 2017-02-27 20:08:42 +00:00
cloudabi32 Don't let cpu_set_syscall_retval() clobber exec_setregs(). 2017-11-24 07:35:08 +00:00
conf Update several more URLs 2017-10-29 08:17:03 +00:00
freescale sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
include sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
lpc Add and use a MMC_DECLARE_BRIDGE macro for declaring mmc(4) bridges 2017-03-07 22:42:44 +00:00
mv sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
nvidia tegra: Do not define early printf function 2017-10-19 20:52:17 +00:00
qemu Tag all armv7 kernels as such in their machine config line. 2017-10-05 23:01:50 +00:00
ralink [arm] [rt1310] add initial RT1310 SoC code. 2017-05-06 06:14:46 +00:00
rockchip Tag all armv7 kernels as such in their machine config line. 2017-10-05 23:01:50 +00:00
samsung/exynos Tag all armv7 kernels as such in their machine config line. 2017-10-05 23:01:50 +00:00
ti sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
versatile sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
xilinx Tag all armv7 kernels as such in their machine config line. 2017-10-05 23:01:50 +00:00
xscale Indent protection and some other oops from the prvious commits. 2017-11-20 19:56:11 +00:00