system freeze on objcache_get

Simon 'corecode' Schubert corecode at fs.ei.tum.de
Mon Jul 30 07:09:12 PDT 2007


Simon 'corecode' Schubert wrote:
there we go.  turns out cperciva fixed that in freebsd in 2005, rev. 
1.277.  fix will arrive now in dragonfly as well.
see attached patch.  pls review + comment.

cheers
 simon
Index: emulation/linux/i386/linux_machdep.c
===================================================================
RCS file: /cvs/src/sys/emulation/linux/i386/linux_machdep.c,v
retrieving revision 1.20
diff -u -r1.20 linux_machdep.c
--- emulation/linux/i386/linux_machdep.c	3 Feb 2007 17:05:57 -0000	1.20
+++ emulation/linux/i386/linux_machdep.c	30 Jul 2007 13:09:52 -0000
@@ -135,6 +135,13 @@
 
 	exec_free_args(&exec_args);
 	linux_free_path(&path);
+
+	if (error < 0) {
+		/* We hit a leathal error condition.  Let's die now. */
+		exit1(W_EXITCODE(0, SIGABRT));
+		/* NOTREACHED */
+	}
+
 	return(error);
 }
 
Index: kern/kern_exec.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_exec.c,v
retrieving revision 1.59
diff -u -r1.59 kern_exec.c
--- kern/kern_exec.c	12 Jul 2007 21:56:22 -0000	1.59
+++ kern/kern_exec.c	30 Jul 2007 13:22:14 -0000
@@ -160,6 +160,12 @@
  */
 static const struct execsw **execsw;
 
+/*
+ * Replace current vmspace with a new binary.
+ * Returns 0 on success, > 0 on recoverable error (use as errno).
+ * Returns -1 on leathal error which demands killing of the current
+ * process!
+ */
 int
 kern_execve(struct nlookupdata *nd, struct image_args *args)
 {
@@ -501,10 +507,13 @@
 	if (imgp->vmspace_destroyed & 2)
 		p->p_flag &= ~P_INEXEC;
 	if (imgp->vmspace_destroyed) {
-		/* sorry, no more process anymore. exit gracefully */
-		exit1(W_EXITCODE(0, SIGABRT));
-		/* NOT REACHED */
-		return(0);
+		/*
+		 * Sorry, no more process anymore. exit gracefully.
+		 * However we can't die right here, because our
+		 * caller might have to clean up, so indicate a
+		 * leathal error by returning -1.
+		 */
+		return(-1);
 	} else {
 		return(error);
 	}
@@ -530,6 +539,12 @@
 	nlookup_done(&nd);
 	exec_free_args(&args);
 
+	if (error < 0) {
+		/* We hit a leathal error condition.  Let's die now. */
+		exit1(W_EXITCODE(0, SIGABRT));
+		/* NOTREACHED */
+	}
+
 	/*
 	 * The syscall result is returned in registers to the new program.
 	 * Linux will register %edx as an atexit function and we must be




More information about the Bugs mailing list