Disallow non page-aligned file offsets in vm_mmap(). We don't support this
in either the high or low level parts of the VM system. Just return EINVAL in this case, just like SunOS does.
This commit is contained in:
parent
f550a707bd
commit
bc9ad24756
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=7215
@ -38,7 +38,7 @@
|
||||
* from: Utah $Hdr: vm_mmap.c 1.6 91/10/21$
|
||||
*
|
||||
* @(#)vm_mmap.c 8.4 (Berkeley) 1/12/94
|
||||
* $Id: vm_mmap.c,v 1.15 1995/03/19 14:29:25 davidg Exp $
|
||||
* $Id: vm_mmap.c,v 1.16 1995/03/21 02:54:04 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -625,6 +625,17 @@ vm_mmap(map, addr, size, prot, maxprot, flags, handle, foff)
|
||||
(void) vm_map_remove(map, *addr, *addr + size);
|
||||
}
|
||||
|
||||
/*
|
||||
* We currently can only deal with page aligned file offsets.
|
||||
* The check is here rather than in the syscall because the
|
||||
* kernel calls this function internally for other mmaping
|
||||
* operations (such as in exec) and non-aligned offsets will
|
||||
* cause pmap inconsistencies...so we want to be sure to
|
||||
* disallow this in all cases.
|
||||
*/
|
||||
if (foff & PAGE_MASK)
|
||||
return (EINVAL);
|
||||
|
||||
/*
|
||||
* Lookup/allocate pager. All except an unnamed anonymous lookup gain
|
||||
* a reference to ensure continued existance of the object. (XXX the
|
||||
|
Loading…
Reference in New Issue
Block a user