Date: Fri, 18 Jun 2010 15:25:58 +0000 (UTC) From: Alexander Kabaev <kan@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r209304 - in stable/8/sys: amd64/linux32 i386/linux Message-ID: <201006181525.o5IFPwEX095849@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kan Date: Fri Jun 18 15:25:57 2010 New Revision: 209304 URL: http://svn.freebsd.org/changeset/base/209304 Log: MFC r208994: Do not require pos parameter to be zero in MAP_ANONYMOUS mmap requests in Linux emulation layer. Linux seems to only require that pos is page-aligned, but otherwise ignores it. Default FreeBSD mmap parameter checking is too strict to allow some Linux binaries to run. tsMuxeR is one example of such a binary. Discussed with: jhb Modified: stable/8/sys/amd64/linux32/linux32_machdep.c stable/8/sys/i386/linux/linux_machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/geom/sched/ (props changed) Modified: stable/8/sys/amd64/linux32/linux32_machdep.c ============================================================================== --- stable/8/sys/amd64/linux32/linux32_machdep.c Fri Jun 18 15:17:38 2010 (r209303) +++ stable/8/sys/amd64/linux32/linux32_machdep.c Fri Jun 18 15:25:57 2010 (r209304) @@ -835,9 +835,13 @@ linux_mmap_common(struct thread *td, l_u bsd_args.flags |= MAP_PRIVATE; if (flags & LINUX_MAP_FIXED) bsd_args.flags |= MAP_FIXED; - if (flags & LINUX_MAP_ANON) + if (flags & LINUX_MAP_ANON) { + /* Enforce pos to be on page boundary, then ignore. */ + if ((pos & PAGE_MASK) != 0) + return (EINVAL); + pos = 0; bsd_args.flags |= MAP_ANON; - else + } else bsd_args.flags |= MAP_NOSYNC; if (flags & LINUX_MAP_GROWSDOWN) bsd_args.flags |= MAP_STACK; Modified: stable/8/sys/i386/linux/linux_machdep.c ============================================================================== --- stable/8/sys/i386/linux/linux_machdep.c Fri Jun 18 15:17:38 2010 (r209303) +++ stable/8/sys/i386/linux/linux_machdep.c Fri Jun 18 15:25:57 2010 (r209304) @@ -667,9 +667,13 @@ linux_mmap_common(struct thread *td, l_u bsd_args.flags |= MAP_PRIVATE; if (flags & LINUX_MAP_FIXED) bsd_args.flags |= MAP_FIXED; - if (flags & LINUX_MAP_ANON) + if (flags & LINUX_MAP_ANON) { + /* Enforce pos to be on page boundary, then ignore. */ + if ((pos & PAGE_MASK) != 0) + return (EINVAL); + pos = 0; bsd_args.flags |= MAP_ANON; - else + } else bsd_args.flags |= MAP_NOSYNC; if (flags & LINUX_MAP_GROWSDOWN) bsd_args.flags |= MAP_STACK;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006181525.o5IFPwEX095849>