Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 04 Mar 2007 15:27:25 -0800
From:      Doug Barton <dougb@FreeBSD.org>
To:        jkim@freebsd.org,  freebsd-emulation@freebsd.org
Subject:   Linux emulation instability
Message-ID:  <45EB55DD.4030201@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------080703080409030301040606
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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


--------------080703080409030301040606
Content-Type: text/plain;
 name="linux-bad.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="linux-bad.diff"

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) {
 		/* 

--------------080703080409030301040606--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45EB55DD.4030201>