Date: Fri, 1 Jun 2018 21:37:43 +0000 (UTC) From: Alan Cox <alc@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334499 - head/sys/vm Message-ID: <201806012137.w51Lbhvc065622@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: alc Date: Fri Jun 1 21:37:42 2018 New Revision: 334499 URL: https://svnweb.freebsd.org/changeset/base/334499 Log: Only a small subset of mmap(2)'s flags should be used in combination with the flag MAP_GUARD. Rather than enumerating the flags that are not allowed, enumerate the flags that are allowed. The list of allowed flags is much shorter and less likely to change. (As an aside, one of the previously enumerated flags, MAP_PREFAULT, was not even a legal flag for mmap(2). However, because of an earlier check within kern_mmap(), this misuse of MAP_PREFAULT was harmless.) Reviewed by: kib MFC after: 10 days Modified: head/sys/vm/vm_mmap.c Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Fri Jun 1 21:37:20 2018 (r334498) +++ head/sys/vm/vm_mmap.c Fri Jun 1 21:37:42 2018 (r334499) @@ -241,8 +241,8 @@ kern_mmap(struct thread *td, uintptr_t addr0, size_t s (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC)) != 0) return (EINVAL); if ((flags & MAP_GUARD) != 0 && (prot != PROT_NONE || fd != -1 || - pos != 0 || (flags & (MAP_SHARED | MAP_PRIVATE | MAP_PREFAULT | - MAP_PREFAULT_READ | MAP_ANON | MAP_STACK)) != 0)) + pos != 0 || (flags & ~(MAP_FIXED | MAP_GUARD | MAP_EXCL | + MAP_32BIT | MAP_ALIGNMENT_MASK)) != 0)) return (EINVAL); /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806012137.w51Lbhvc065622>