freebsd-nq/sys/amd64/linux32
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
..
linux32_dummy.c Implement Linux mincore() system call. 2017-03-25 15:47:29 +00:00
linux32_genassym.c
linux32_locore.s
linux32_machdep.c Add linux_preadv() and linux_pwritev() syscalls to Linuxulator. 2017-02-24 20:04:02 +00:00
linux32_proto.h Regenerated Linuxulator syscall tables for r314782 2017-03-06 18:20:37 +00:00
linux32_support.s Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
linux32_syscall.h Regenerated Linuxulator syscall tables for r314782 2017-03-06 18:20:37 +00:00
linux32_syscalls.c Regenerated Linuxulator syscall tables for r314782 2017-03-06 18:20:37 +00:00
linux32_sysent.c Regenerated Linuxulator syscall tables for r314782 2017-03-06 18:20:37 +00:00
linux32_systrace_args.c Regenerated Linuxulator syscall tables for r314782 2017-03-06 18:20:37 +00:00
linux32_sysvec.c Don't let cpu_set_syscall_retval() clobber exec_setregs(). 2017-11-24 07:35:08 +00:00
linux32_vdso.lds.s
linux.h Trying to be more compatible with Linux if.h definitions: 2017-04-08 14:41:39 +00:00
Makefile Don't create pointless backups of generated files in "make sysent". 2016-07-28 21:29:04 +00:00
syscalls.conf
syscalls.master Add UNIMPLEMENTED() placeholder macro for 2017-03-06 18:11:38 +00:00