• Mark Johnston's avatar
    Relax restrictions on private mappings of POSIX shm objects. · c7841c6b
    Mark Johnston authored
    When creating a private mapping of a POSIX shared memory object,
    VM_PROT_WRITE should always be included in maxprot regardless of
    permissions on the underlying FD.  Otherwise it is possible to open a
    shm object read-only, map it with MAP_PRIVATE and PROT_WRITE, and
    violate the invariant in vm_map_insert() that (prot & maxprot) == prot.
    
    Reported by:	syzkaller
    Reviewed by:	kevans, kib
    MFC after:	1 week
    Sponsored by:	The FreeBSD Foundation
    Differential Revision:	https://reviews.freebsd.org/D24398
    c7841c6b