svn commit: r185533 - head/sys/kern

Alexander Kabaev kan at FreeBSD.org
Mon Dec 1 14:33:51 PST 2008


Author: kan
Date: Mon Dec  1 22:33:50 2008
New Revision: 185533
URL: http://svn.freebsd.org/changeset/base/185533

Log:
  Shared memory objects that have size which is not necessarily equal to
  exact multiple of system page size should still be allowed to be mapped
  in their entirety to match the regular vnode backed file behavior.
  
  Reported by: ed
  Reviewed by: jhb

Modified:
  head/sys/kern/uipc_shm.c

Modified: head/sys/kern/uipc_shm.c
==============================================================================
--- head/sys/kern/uipc_shm.c	Mon Dec  1 21:15:04 2008	(r185532)
+++ head/sys/kern/uipc_shm.c	Mon Dec  1 22:33:50 2008	(r185533)
@@ -605,7 +605,8 @@ shm_mmap(struct shmfd *shmfd, vm_size_t 
 	 * XXXRW: This validation is probably insufficient, and subject to
 	 * sign errors.  It should be fixed.
 	 */
-	if (foff >= shmfd->shm_size || foff + objsize > shmfd->shm_size)
+	if (foff >= shmfd->shm_size ||
+	    foff + objsize > round_page(shmfd->shm_size))
 		return (EINVAL);
 
 	mtx_lock(&shm_timestamp_lock);


More information about the svn-src-head mailing list