Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Dec 2008 22:33:50 +0000 (UTC)
From:      Alexander Kabaev <kan@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r185533 - head/sys/kern
Message-ID:  <200812012233.mB1MXojv039186@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812012233.mB1MXojv039186>