diff options
author | dg <dg@FreeBSD.org> | 1995-03-21 10:15:52 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1995-03-21 10:15:52 +0000 |
commit | 0d274572e35245942a094cbb30772453c9a4c109 (patch) | |
tree | 6a591bdd52a4a37ced2c2e72c64ca102f69d070d | |
parent | 8772a34db187eba8ad329bb1de5215fab194bd55 (diff) | |
download | FreeBSD-src-0d274572e35245942a094cbb30772453c9a4c109.zip FreeBSD-src-0d274572e35245942a094cbb30772453c9a4c109.tar.gz |
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.
-rw-r--r-- | sys/vm/vm_mmap.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index 3524354..177e880 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -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 $ */ /* @@ -626,6 +626,17 @@ vm_mmap(map, addr, size, prot, maxprot, flags, handle, foff) } /* + * 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 * exception is to appease the pageout daemon) |