]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit - sys/compat/linux/linux_emul.c
Fix execution of linux binary from multithreaded non-Linux process.
authorKonstantin Belousov <kib@FreeBSD.org>
Thu, 18 Jun 2020 20:49:56 +0000 (20:49 +0000)
committerKonstantin Belousov <kib@FreeBSD.org>
Thu, 18 Jun 2020 20:49:56 +0000 (20:49 +0000)
commit8a15ac837819d19bb5f7d2cfa4ed9b4aa7690148
treea72f057e9e3e34976b852c7a16b66c52cee6f458
parentb32fb2a4ea132322506f73432d9d88289557a16c
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
sys/compat/linux/linux_emul.c