Date: Mon, 24 Aug 2020 12:26:49 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364659 - stable/12/sys/compat/linux Message-ID: <202008241226.07OCQnEq021624@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Mon Aug 24 12:26:49 2020 New Revision: 364659 URL: https://svnweb.freebsd.org/changeset/base/364659 Log: MFC r357076: Make linux(4) handle MAP_32BIT. This unbreaks Mono (mono-devel-4.6.2.7+dfsg-1ubuntu1 from Ubuntu Bionic); previously would crash on "amd64_is_imm32" assert. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_mmap.c stable/12/sys/compat/linux/linux_mmap.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_mmap.c ============================================================================== --- stable/12/sys/compat/linux/linux_mmap.c Mon Aug 24 12:23:55 2020 (r364658) +++ stable/12/sys/compat/linux/linux_mmap.c Mon Aug 24 12:26:49 2020 (r364659) @@ -113,7 +113,15 @@ linux_mmap_common(struct thread *td, uintptr_t addr, s if (flags & LINUX_MAP_GROWSDOWN) bsd_flags |= MAP_STACK; +#if defined(__amd64__) /* + * According to the Linux mmap(2) man page, "MAP_32BIT flag + * is ignored when MAP_FIXED is set." + */ + if ((flags & LINUX_MAP_32BIT) && (flags & LINUX_MAP_FIXED) == 0) + bsd_flags |= MAP_32BIT; + + /* * PROT_READ, PROT_WRITE, or PROT_EXEC implies PROT_READ and PROT_EXEC * on Linux/i386 if the binary requires executable stack. * We do this only for IA32 emulation as on native i386 this is does not @@ -121,7 +129,6 @@ linux_mmap_common(struct thread *td, uintptr_t addr, s * * XXX. Linux checks that the file system is not mounted with noexec. */ -#if defined(__amd64__) linux_fixup_prot(td, &prot); #endif Modified: stable/12/sys/compat/linux/linux_mmap.h ============================================================================== --- stable/12/sys/compat/linux/linux_mmap.h Mon Aug 24 12:23:55 2020 (r364658) +++ stable/12/sys/compat/linux/linux_mmap.h Mon Aug 24 12:26:49 2020 (r364659) @@ -39,6 +39,7 @@ #define LINUX_MAP_PRIVATE 0x0002 #define LINUX_MAP_FIXED 0x0010 #define LINUX_MAP_ANON 0x0020 +#define LINUX_MAP_32BIT 0x0040 #define LINUX_MAP_GROWSDOWN 0x0100 #define LINUX_PROT_GROWSDOWN 0x01000000
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008241226.07OCQnEq021624>