I discovered (the hard way) yesterday that some of the error paths in
execv() in sol2 don't release the execv lock.
sigh.
Patch follows, and will also appear on the web site. (Those of you who
stuck to your own code can ignore this.)
Index: sol2/kern/userprog/runprogram.c
===================================================================
RCS file: /disk/disk0/cs161/CVSREPO/os161/sol2/kern/userprog/runprogram.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- runprogram.c 2002/03/07 22:59:39 1.14
+++ runprogram.c 2002/03/28 22:49:28 1.15
@@ -310,17 +310,20 @@
/* make up argv strings */
if (strlen(progname) + 1 > ARG_MAX) {
+ lock_release(argdata.lock);
return E2BIG;
}
/* allocate the space */
argdata.buffer = kmalloc(strlen(progname) + 1);
if (argdata.buffer == NULL) {
+ lock_release(argdata.lock);
return ENOMEM;
}
argdata.offsets = kmalloc(sizeof(size_t));
if (argdata.offsets == NULL) {
kfree(argdata.buffer);
+ lock_release(argdata.lock);
return ENOMEM;
}
@@ -397,11 +400,13 @@
/* allocate the space */
argdata.buffer = kmalloc(ARG_MAX);
if (argdata.buffer == NULL) {
+ lock_release(argdata.lock);
return ENOMEM;
}
argdata.offsets = kmalloc(NARG_MAX * sizeof(size_t));
if (argdata.offsets == NULL) {
kfree(argdata.buffer);
+ lock_release(argdata.lock);
return ENOMEM;
}
--
- David A. Holland / dholland(a)eecs.harvard.edu
Show replies by date