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
This commit is contained in:
Alexander Kabaev 2008-12-01 22:33:50 +00:00
parent 24b410f8fe
commit 6ee7dd87ba

View File

@ -605,7 +605,8 @@ shm_mmap(struct shmfd *shmfd, vm_size_t objsize, vm_ooffset_t foff,
* 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);