summaryrefslogtreecommitdiffstats
path: root/sys/kern/imgact_elf.c
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2002-08-13 06:55:28 +0000
committerjeff <jeff@FreeBSD.org>2002-08-13 06:55:28 +0000
commita996673e123dab0805b05084774227cae72d75e5 (patch)
tree9e630263213e8fdda8c938a92f150220b0eb745d /sys/kern/imgact_elf.c
parent216ea61cb629b077f8cf1b29f90f2c08ff1b1eea (diff)
downloadFreeBSD-src-a996673e123dab0805b05084774227cae72d75e5.zip
FreeBSD-src-a996673e123dab0805b05084774227cae72d75e5.tar.gz
- Hold the vnode lock throughout execve.
- Set VV_TEXT in the top level execve code. - Fixup the image activators to deal with the newly locked vnode.
Diffstat (limited to 'sys/kern/imgact_elf.c')
-rw-r--r--sys/kern/imgact_elf.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index 92e86af..7d79c1d 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -599,6 +599,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp)
const char *interp = NULL;
Elf_Brandinfo *brand_info;
char *path;
+ struct thread *td = curthread;
GIANT_REQUIRED;
@@ -624,16 +625,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp)
* From this point on, we may have resources that need to be freed.
*/
- /*
- * Yeah, I'm paranoid. There is every reason in the world to get
- * VTEXT now since from here on out, there are places we can have
- * a context switch. Better safe than sorry; I really don't want
- * the file to change while it's being loaded.
- *
- * XXX We can't really set this flag safely without the vnode lock.
- */
- mp_fixme("This needs the vnode lock to be safe.");
- imgp->vp->v_vflag |= VV_TEXT;
+ VOP_UNLOCK(imgp->vp, 0, td);
if ((error = exec_extract_strings(imgp)) != 0)
goto fail;
@@ -846,6 +838,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp)
imgp->interpreted = 0;
fail:
+ vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY, td);
return error;
}
OpenPOWER on IntegriCloud