diff options
author | alc <alc@FreeBSD.org> | 2010-09-19 19:42:04 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2010-09-19 19:42:04 +0000 |
commit | ec0b99e7f0f65e9161c5baf6c115e6bf1ee2da41 (patch) | |
tree | 16cf09ce612a75551106e74aebf06cd924ccc5e9 /sys/vm/vm_mmap.c | |
parent | f3dba8dd74cc15ab257490b9d68192a103c8f07e (diff) | |
download | FreeBSD-src-ec0b99e7f0f65e9161c5baf6c115e6bf1ee2da41.zip FreeBSD-src-ec0b99e7f0f65e9161c5baf6c115e6bf1ee2da41.tar.gz |
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
Diffstat (limited to 'sys/vm/vm_mmap.c')
-rw-r--r-- | sys/vm/vm_mmap.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index 63dfb67..80a2d0a 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -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 |