svn commit: r212873 - head/sys/vm

Alan Cox alc at FreeBSD.org
Sun Sep 19 19:42:05 UTC 2010


Author: alc
Date: Sun Sep 19 19:42:04 2010
New Revision: 212873
URL: http://svn.freebsd.org/changeset/base/212873

Log:
  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

Modified:
  head/sys/vm/vm_mmap.c

Modified: head/sys/vm/vm_mmap.c
==============================================================================
--- head/sys/vm/vm_mmap.c	Sun Sep 19 19:18:35 2010	(r212872)
+++ head/sys/vm/vm_mmap.c	Sun Sep 19 19:42:04 2010	(r212873)
@@ -1373,7 +1373,8 @@ vm_mmap_shm(struct thread *td, vm_size_t
 {
 	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


More information about the svn-src-head mailing list