summaryrefslogtreecommitdiffstats
path: root/sys/i386/ibcs2
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/i386/ibcs2
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/i386/ibcs2')
-rw-r--r--sys/i386/ibcs2/imgact_coff.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/sys/i386/ibcs2/imgact_coff.c b/sys/i386/ibcs2/imgact_coff.c
index 61ca412..0e5363e 100644
--- a/sys/i386/ibcs2/imgact_coff.c
+++ b/sys/i386/ibcs2/imgact_coff.c
@@ -301,6 +301,7 @@ exec_coff_imgact(imgp)
unsigned long data_offset = 0, data_address = 0, data_size = 0;
unsigned long bss_size = 0;
caddr_t hole;
+ struct thread *td = curthread;
if (fhdr->f_magic != I386_COFF ||
!(fhdr->f_flags & F_EXEC)) {
@@ -328,9 +329,11 @@ exec_coff_imgact(imgp)
((const char*)(imgp->image_header) + sizeof(struct filehdr) +
sizeof(struct aouthdr));
+ VOP_UNLOCK(imgp->vp, 0, td);
+
if ((error = exec_extract_strings(imgp)) != 0) {
DPRINTF(("%s(%d): return %d\n", __FILE__, __LINE__, error));
- return error;
+ goto fail;
}
exec_new_vmspace(imgp, VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS, USRSTACK);
@@ -375,7 +378,8 @@ exec_coff_imgact(imgp)
0,
(caddr_t) imgp->vp,
foff)) != 0) {
- return ENOEXEC;
+ error = ENOEXEC;
+ goto fail;
}
if(scns[i].s_size) {
char *libbuf;
@@ -410,7 +414,7 @@ exec_coff_imgact(imgp)
(vm_offset_t) buf + len))
panic("exec_coff_imgact vm_map_remove failed");
if (error)
- return error;
+ goto fail;
}
}
/*
@@ -427,7 +431,7 @@ exec_coff_imgact(imgp)
text_size, text_size,
VM_PROT_READ | VM_PROT_EXECUTE)) != 0) {
DPRINTF(("%s(%d): error = %d\n", __FILE__, __LINE__, error));
- return error;
+ goto fail;
}
/*
* Map in .data and .bss now
@@ -445,7 +449,7 @@ exec_coff_imgact(imgp)
VM_PROT_ALL)) != 0) {
DPRINTF(("%s(%d): error = %d\n", __FILE__, __LINE__, error));
- return error;
+ goto fail;
}
imgp->interpreted = 0;
@@ -472,10 +476,10 @@ exec_coff_imgact(imgp)
ctob(vmspace->vm_dsize) + vmspace->vm_daddr ));
DPRINTF(("%s(%d): returning successfully!\n", __FILE__, __LINE__));
- /* Indicate that this file should not be modified */
- mp_fixme("Unlocked v_flag access");
- imgp->vp->v_vflag |= VV_TEXT;
- return 0;
+fail:
+ vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY, td);
+
+ return error;
}
/*
OpenPOWER on IntegriCloud