From 61fe1f4a9974977adaffccef468e2f2f5fa84577 Mon Sep 17 00:00:00 2001 From: dchagin Date: Sat, 6 Jun 2015 06:12:14 +0000 Subject: Finish r283544. In exec case properly detach threads from user space before suicide. --- sys/compat/linux/linux_emul.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'sys/compat/linux/linux_emul.c') diff --git a/sys/compat/linux/linux_emul.c b/sys/compat/linux/linux_emul.c index a28da8d..c2bf3ae 100644 --- a/sys/compat/linux/linux_emul.c +++ b/sys/compat/linux/linux_emul.c @@ -219,6 +219,18 @@ void linux_proc_exec(void *arg __unused, struct proc *p, struct image_params *imgp) { struct thread *td = curthread; + struct thread *othertd; + + /* + * In a case of execing from linux binary properly detach + * other threads from the user space. + */ + if (__predict_false(SV_PROC_ABI(p) == SV_ABI_LINUX)) { + FOREACH_THREAD_IN_PROC(p, othertd) { + if (td != othertd) + (p->p_sysent->sv_thread_detach)(othertd); + } + } /* * In a case of execing to linux binary we create linux -- cgit v1.1