summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exec.c
diff options
context:
space:
mode:
authorcsjp <csjp@FreeBSD.org>2008-08-12 21:27:48 +0000
committercsjp <csjp@FreeBSD.org>2008-08-12 21:27:48 +0000
commit0cdadff20e7808e801bc3e2b2cdaf40ca9095cc3 (patch)
tree02d9d84ae32e21c8272c4ff8c9a3e0d2e694cc08 /sys/kern/kern_exec.c
parent664b89e716167d21ccdccf60985adb2676571426 (diff)
downloadFreeBSD-src-0cdadff20e7808e801bc3e2b2cdaf40ca9095cc3.zip
FreeBSD-src-0cdadff20e7808e801bc3e2b2cdaf40ca9095cc3.tar.gz
Reduce the scope of the vnode lock such that it does not cover
the various copyouts associated with initializing the process's argv/env data in userspace. It is possible that these copyout operations can fault under memory pressure, possibly resulting in dead locks. This is believed to be safe since none of the copyout_strings() operations need to interact with the vnode here. Submitted by: Zhouyi Zhou PR: kern/111260 Discussed with: kib MFC after: 3 weeks
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r--sys/kern/kern_exec.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index b4f3ccc..0997949 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -514,6 +514,11 @@ interpret:
}
/*
+ * NB: We unlock the vnode here because it is believed that none
+ * of the sv_copyout_strings/sv_fixup operations require the vnode.
+ */
+ VOP_UNLOCK(imgp->vp, 0);
+ /*
* Copy out strings (args and env) and initialize stack base
*/
if (p->p_sysent->sv_copyout_strings)
@@ -550,7 +555,6 @@ interpret:
}
/* close files on exec */
- VOP_UNLOCK(imgp->vp, 0);
fdcloseexec(td);
vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY);
OpenPOWER on IntegriCloud