Date: Tue, 27 Feb 2007 01:54:25 GMT From: Jung-uk Kim <jkim@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 115094 for review Message-ID: <200702270154.l1R1sPw5060880@repoman.freebsd.org>
index | next in thread | raw e-mail
http://perforce.freebsd.org/chv.cgi?CH=115094 Change 115094 by jkim@jkim_hammer on 2007/02/27 01:54:21 Linux does not check file descriptor when MAP_ANONYMOUS is set. This should fix recent LTP test regressions. Affected files ... .. //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_machdep.c#43 edit .. //depot/projects/linuxolator/src/sys/i386/linux/linux_machdep.c#34 edit Differences ... ==== //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_machdep.c#43 (text+ko) ==== @@ -831,7 +831,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 @@ -839,7 +841,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); @@ -854,7 +856,6 @@ fdrop(fp, td); } - bsd_args.fd = linux_args->fd; if (linux_args->flags & LINUX_MAP_GROWSDOWN) { /* ==== //depot/projects/linuxolator/src/sys/i386/linux/linux_machdep.c#34 (text+ko) ==== @@ -669,7 +669,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 @@ -677,7 +679,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); @@ -692,7 +694,6 @@ fdrop(fp, td); } - bsd_args.fd = linux_args->fd; if (linux_args->flags & LINUX_MAP_GROWSDOWN) { /*help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200702270154.l1R1sPw5060880>
