summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordchagin <dchagin@FreeBSD.org>2016-01-09 18:17:58 +0000
committerdchagin <dchagin@FreeBSD.org>2016-01-09 18:17:58 +0000
commitea82ee5fc1a9293c788007934ded32603845e258 (patch)
tree7aa3a3d8e4c3b8af9d6d2fa7e2b650d53155a2da
parent9ef3c112371c0699076d74e6e6fab09a70ed7c8e (diff)
downloadFreeBSD-src-ea82ee5fc1a9293c788007934ded32603845e258.zip
FreeBSD-src-ea82ee5fc1a9293c788007934ded32603845e258.tar.gz
MFC r284051:
Finish r283544. In exec case properly detach threads from user space before suicide.
-rw-r--r--sys/compat/linux/linux_emul.c12
1 files changed, 12 insertions, 0 deletions
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
OpenPOWER on IntegriCloud