PERFORCE change 1199442 for review
John Baldwin
jhb at FreeBSD.org
Mon Sep 8 04:52:29 UTC 2014
http://p4web.freebsd.org/@@1199442?ac=10
Change 1199442 by jhb at 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,
More information about the p4-projects
mailing list