HomeFreeBSD

Fix execution of linux binary from multithreaded non-Linux process.

Description

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

Details

Provenance
kibAuthored on
Reviewer
markj
Differential Revision
D25293: Fix execution of linux binary from multithreaded process.
Parents
rS362341: Merge commit 0cecafd647cc from llvm git (by Alina Sbirlea):
Branches
Unknown
Tags
Unknown