Linux emulation instability

Doug Barton dougb at FreeBSD.org
Sun Mar 4 23:54:08 UTC 2007


jkim,

The attached change to sys/i386/linux/linux_machdep.c causes my linux 
emulation to spontaneously reboot my machine (no panic, just BOOM) 
whenever I use the linux version of the thunderbird beta (that I'm 
using right now to type this). I built a system from sources right 
before this change and everything is normal, then when I add this 
change it becomes unstable.

I'm currently in the process of building an up to date -current 
without this change to see if that's stable for me, but I thought 
you'd want to know ASAP.

Doug

-- 

     This .signature sanitized for your protection

-------------- next part --------------
Index: linux_machdep.c
===================================================================
RCS file: /usr/local/ncvs/src/sys/i386/linux/linux_machdep.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -r1.72 -r1.73
--- linux_machdep.c	24 Feb 2007 16:49:25 -0000	1.72
+++ linux_machdep.c	27 Feb 2007 02:08:01 -0000	1.73
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/linux/linux_machdep.c,v 1.72 2007/02/24 16:49:25 netchild Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/linux/linux_machdep.c,v 1.73 2007/02/27 02:08:01 jkim Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -684,7 +684,9 @@
 	if (bsd_args.prot & (PROT_READ | PROT_WRITE | PROT_EXEC))
 		bsd_args.prot |= PROT_READ | PROT_EXEC;
 
-	if (linux_args->fd != -1) {
+	/* Linux does not check file descriptor when MAP_ANONYMOUS is set. */
+	bsd_args.fd = (bsd_args.flags & MAP_ANON) ? -1 : linux_args->fd;
+	if (bsd_args.fd != -1) {
 		/*
 		 * Linux follows Solaris mmap(2) description:
 		 * The file descriptor fildes is opened with
@@ -692,7 +694,7 @@
 		 * protection options specified.
 		 */
 
-		if ((error = fget(td, linux_args->fd, &fp)) != 0)
+		if ((error = fget(td, bsd_args.fd, &fp)) != 0)
 			return (error);
 		if (fp->f_type != DTYPE_VNODE) {
 			fdrop(fp, td);
@@ -707,7 +709,6 @@
 
 		fdrop(fp, td);
 	}
-	bsd_args.fd = linux_args->fd;
 
 	if (linux_args->flags & LINUX_MAP_GROWSDOWN) {
 		/* 


More information about the freebsd-emulation mailing list