freebsd-skq/sys/powerpc
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
..
aim Replace manyinstances of VM_WAIT with blocking page allocation flags 2017-11-08 02:39:37 +00:00
booke Check the page table before TLB1 in pmap_kextract() 2017-11-21 03:12:16 +00:00
conf Stop passing -me500 to the assembler for Book-E kernels 2017-11-04 00:47:21 +00:00
cpufreq Add cpufreq support for P1022 and MPC8536 2017-07-21 03:40:05 +00:00
fpu 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
mambo
mikrotik - Allow different slicers for different flash types to be registered 2017-02-22 10:21:39 +00:00
mpc85xx Expand the Freescale PCIe root complex driver with the ofw_pcib_pci 2017-11-14 03:53:15 +00:00
ofw Stop special casing 32-bit AIM in memory parsing 2017-11-17 04:10:52 +00:00
powermac sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
powerpc Don't let cpu_set_syscall_retval() clobber exec_setregs(). 2017-11-24 07:35:08 +00:00
ps3 Always null-terminate ccb_pathinq.(sim_vid|hba_vid|dev_name) 2017-01-04 20:26:42 +00:00
pseries Always null-terminate ccb_pathinq.(sim_vid|hba_vid|dev_name) 2017-01-04 20:26:42 +00:00
psim Allow setting access-width for UART registers. 2017-02-27 20:08:42 +00:00