Allow a POSIX shared memory object that is opened for read but not for

write to nonetheless be mapped PROT_WRITE and MAP_PRIVATE, i.e.,
copy-on-write.

(This is a regression in the new implementation of POSIX shared memory
objects that is used by HEAD and RELENG_8.  This bug does not exist in
RELENG_7's user-level, file-based implementation.)

PR:		150260
MFC after:	3 weeks
This commit is contained in:
Alan Cox
2010-09-19 19:42:04 +00:00
parent 8304adaac6
commit da0483096d
+2 -1
View File
@@ -1373,7 +1373,8 @@ vm_mmap_shm(struct thread *td, vm_size_t objsize,
{
int error;
if ((*maxprotp & VM_PROT_WRITE) == 0 &&
if ((*flagsp & MAP_SHARED) != 0 &&
(*maxprotp & VM_PROT_WRITE) == 0 &&
(prot & PROT_WRITE) != 0)
return (EACCES);
#ifdef MAC