freebsd-dev/sys/compat/linux
Konstantin Belousov 8a15ac8378 Fix execution of linux binary from multithreaded non-Linux process.
If multithreaded non-Linux process execs Linux binary, then non-Linux
threads different from the one that execing are cleared by
single-threading at boundary, and then terminating them in
post_execve(). Since at that time the process is already switched to
linux ABI, linuxolator is involved in the thread clearing on boundary,
but cannot find the emul data.

Handle it by pre-creating emuldata for all threads in the execing process.

Also remove a code in linux_proc_exec() handler that cleared emul data
for other threads when execing from multithreaded Linux process. It is
excessive.

PR:	247020
Reported by:	Martin FIlla <freebsd@sysctl.cz>
Reported by:	Henrique L. Amorim, Independent Security Researcher
Reported by:	Rodrigo Rubira Branco (BSDaemon), Amazon Web Services
Reviewed by:	markj
Tested by:	trasz
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D25293
2020-06-18 20:49:56 +00:00
..
check_error.d
check_internal_locks.d Linuxolator whitespace cleanup 2018-02-05 17:29:12 +00:00
linux_common.c Make linux(4) create /dev/shm. Linux applications often expect 2019-11-06 20:53:33 +00:00
linux_common.h Our bsd_to_linux_sockaddr() and linux_to_bsd_sockaddr() functions 2019-05-13 17:48:16 +00:00
linux_dtrace.h sys/compat: further adoption of SPDX licensing ID tags. 2017-11-27 15:13:23 +00:00
linux_emul.c Fix execution of linux binary from multithreaded non-Linux process. 2020-06-18 20:49:56 +00:00
linux_emul.h Implement PTRACE_O_TRACESYSGOOD. This makes Linux strace(1) work. 2019-05-19 12:58:44 +00:00
linux_errno.c Share Linux errno table with libsysdecode 2018-03-22 12:58:49 +00:00
linux_errno.inc Create new EINTEGRITY error with message "Integrity check failed". 2019-01-17 06:35:45 +00:00
linux_event.c Don't use newlines with linux_msg(). No functional changes. 2020-06-11 14:57:30 +00:00
linux_event.h Linux epoll: Register events with zero event mask 2019-11-24 20:47:40 +00:00
linux_file.c Make linux(4) warn about unsupported fcntls. 2020-06-12 14:25:32 +00:00
linux_file.h Replace LINUX_FASYNC with LINUX_O_ASYNC; no functional changes. 2020-06-11 14:09:43 +00:00
linux_fork.c schedlock 1/4 2019-12-15 21:11:15 +00:00
linux_futex.c Don't use newlines with linux_msg(). No functional changes. 2020-06-11 14:57:30 +00:00
linux_futex.h linux: futex_mtx should follow futex_list 2019-10-18 12:25:33 +00:00
linux_getcwd.c cache: replace kern___getcwd with vn_getcwd 2020-02-01 20:38:38 +00:00
linux_ioctl.c Centralize compatability translation macros. 2020-04-14 20:30:48 +00:00
linux_ioctl.h Add support for the device statistics IOCTL, needed by the coming 2020-03-10 15:56:49 +00:00
linux_ipc64.h Linuxolator whitespace cleanup 2018-02-05 17:29:12 +00:00
linux_ipc.c Linux between 4.18 and 5.0 split IPC system calls. 2019-03-24 14:44:35 +00:00
linux_ipc.h Update syscall.master to 5.0. 2019-03-24 14:50:02 +00:00
linux_mib.c Add compat.linux.debug sysctl, to make it possible to silence down 2020-06-12 14:37:50 +00:00
linux_mib.h Add compat.linux.debug sysctl, to make it possible to silence down 2020-06-12 14:37:50 +00:00
linux_misc.c Make Linux uname(2) return x86_64 to 32-bit apps. This helps Steam. 2020-06-15 20:12:10 +00:00
linux_misc.h linuxulator: Map scheduler priorities to Linux priorities. 2020-03-01 13:12:04 +00:00
linux_mmap.c Introduce kern_mmap_req(). 2020-03-04 21:27:12 +00:00
linux_mmap.h Make linux(4) handle MAP_32BIT. 2020-01-24 12:08:23 +00:00
linux_persona.h Linuxolator whitespace cleanup 2018-02-05 17:29:12 +00:00
linux_signal.c Add kern_kill() and use it in Linuxulator. It's just a cleanup, 2019-12-13 18:44:02 +00:00
linux_signal.h Rationalize license text on Linuxolator files 2018-03-23 14:39:34 +00:00
linux_socket.c Make linux(4) warn about unsupported CMSG level/type. 2020-06-14 14:38:40 +00:00
linux_socket.h Minor code cleanup; no functional changes. 2020-06-12 14:23:10 +00:00
linux_stats.c vfs: reimplement deferred inactive to use a dedicated flag (VI_DEFINACT) 2020-01-07 15:56:24 +00:00
linux_sysctl.c Quiet unused fn warning for linuxulator w/o legacy syscalls 2018-06-25 19:24:50 +00:00
linux_sysproto.h sys/compat: further adoption of SPDX licensing ID tags. 2017-11-27 15:13:23 +00:00
linux_time.c Fix clock_gettime() and clock_getres() for cpu clocks: 2020-02-04 05:27:05 +00:00
linux_timer.c
linux_timer.h Centralize compatability translation macros. 2020-04-14 20:30:48 +00:00
linux_uid16.c compat/linux: Remove obsoleted and somewhat confusing comments related to COMPAT_43. 2019-08-11 19:17:29 +00:00
linux_util.c Add compat.linux.debug sysctl, to make it possible to silence down 2020-06-12 14:37:50 +00:00
linux_util.h Add compat.linux.emul_path, so it can be set to something other 2019-12-16 20:07:04 +00:00
linux_vdso.c Fix the last few cases that grab without busy or valid. The grab functions must 2019-12-02 22:38:25 +00:00
linux_vdso.h Avoid using [LINUX_]SHAREDPAGE constant directly in the vdso code. 2017-07-30 21:24:20 +00:00
linux_videodev2_compat.h
linux_videodev_compat.h
linux.c Don't use newlines with linux_msg(). No functional changes. 2020-06-11 14:57:30 +00:00
linux.h compat/linux/linux.h depends on queue.h since r353725. 2020-03-26 17:12:55 +00:00
stats_timing.d Linuxolator whitespace cleanup 2018-02-05 17:29:12 +00:00
trace_futexes.d Linuxolator whitespace cleanup 2018-02-05 17:29:12 +00:00