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 threads in post_execve(). Since at that time the process is already switched to linux ABI, linuxolator is involved in the thread termination but cannot find the emul data.
Handle it by pre-creating emuldata for all threads in the execing process.
NB. There is (was) a code in linux_proc_exec() handler that cleared emul data for other threads when execing from multithreaded Linux process. I do not see how could it work, or why it was needed at all.
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