Date: Mon, 8 Sep 2014 04:51:01 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 1199442 for review Message-ID: <201409080451.s884p1Ja026631@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@1199442?ac=10 Change 1199442 by jhb@jhb_jhbbsd on 2014/08/27 20:36:19 More error checking for mmap(). Affected files ... .. //depot/projects/smpng/sys/vm/vm_mmap.c#105 edit Differences ... ==== //depot/projects/smpng/sys/vm/vm_mmap.c#105 (text+ko) ==== @@ -213,7 +213,7 @@ addr = (vm_offset_t) uap->addr; size = uap->len; - prot = uap->prot & VM_PROT_ALL; + prot = uap->prot; flags = uap->flags; pos = uap->pos; @@ -246,6 +246,14 @@ } if ((flags & (MAP_EXCL | MAP_FIXED)) == MAP_EXCL) return (EINVAL); + if ((prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_NONE)) != 0) + return (EINVAL); + + /* Exactly one of MAP_SHARED or MAP_PRIVATE must be given. */ + if ((flags & (MAP_SHARED | MAP_PRIVATE)) == 0 || + (flags & (MAP_SHARED | MAP_PRIVATE)) == (MAP_SHARED | MAP_PRIVATE)) + return (EINVAL); + /* * Align the file position to a page boundary,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409080451.s884p1Ja026631>