summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2004-09-22 01:30:23 +0000
committerjulian <julian@FreeBSD.org>2004-09-22 01:30:23 +0000
commit5015e1ce1f752bcd12077a0c593c58e8085710df (patch)
tree2aae936736235344a3e186cd31f7543a8d6f3393 /sys
parentfd5eab6b9140f7fdc2d4354c43f415ee2f9c4a7d (diff)
downloadFreeBSD-src-5015e1ce1f752bcd12077a0c593c58e8085710df.zip
FreeBSD-src-5015e1ce1f752bcd12077a0c593c58e8085710df.tar.gz
Revert the last change..
Better to kill all other threads than to panic the system if 2 threads call execve() at the same time. A better fix will be committed later. Note that this only affects the case where the execve fails.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_exec.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 16dd5e6..1a79f48 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -254,6 +254,17 @@ kern_execve(td, fname, argv, envv, mac_p)
PROC_LOCK(p);
KASSERT((p->p_flag & P_INEXEC) == 0,
("%s(): process already has P_INEXEC flag", __func__));
+ if (p->p_flag & P_HADTHREADS) {
+ if (thread_single(SINGLE_EXIT)) {
+ PROC_UNLOCK(p);
+ mtx_unlock(&Giant);
+ return (ERESTART); /* Try again later. */
+ }
+ /*
+ * If we get here all other threads are dead,
+ * and threading mode has been turned off
+ */
+ }
p->p_flag |= P_INEXEC;
PROC_UNLOCK(p);
@@ -345,23 +356,6 @@ interpret:
if (error)
goto exec_fail_dealloc;
- PROC_LOCK(p);
- if (p->p_flag & P_HADTHREADS) {
- if (thread_single(SINGLE_EXIT)) {
- PROC_UNLOCK(p);
- error = ERESTART;
- goto exec_fail_dealloc;
- }
- /*
- * If we get here all other threads are dead,
- * and threading mode has been turned off.
- * Returning to the user from this point on
- * may confuse the thread library as some threads
- * will have just "died".
- */
- }
- PROC_UNLOCK(p);
-
/*
* If the current process has a special image activator it
* wants to try first, call it. For example, emulating shell
OpenPOWER on IntegriCloud