summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_mmap.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2010-03-23 21:08:07 +0000
committerjhb <jhb@FreeBSD.org>2010-03-23 21:08:07 +0000
commit399c01844ad297de82f83cc99f989358723baf51 (patch)
treef24618d081cc374b0fccc722d1b306336d6a1030 /sys/vm/vm_mmap.c
parentd34fe86cb588bb8f80548a0a68036135b45eb07f (diff)
downloadFreeBSD-src-399c01844ad297de82f83cc99f989358723baf51.zip
FreeBSD-src-399c01844ad297de82f83cc99f989358723baf51.tar.gz
Reject attempts to create a MAP_ANON mapping with a non-zero offset.
PR: kern/71258 Submitted by: Alexander Best MFC after: 2 weeks
Diffstat (limited to 'sys/vm/vm_mmap.c')
-rw-r--r--sys/vm/vm_mmap.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
index 4963a60..a47cd6a 100644
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -233,7 +233,7 @@ mmap(td, uap)
/* Make sure mapping fits into numeric range, etc. */
if ((uap->len == 0 && !SV_CURPROC_FLAG(SV_AOUT) &&
curproc->p_osrel >= 800104) ||
- ((flags & MAP_ANON) && uap->fd != -1))
+ ((flags & MAP_ANON) && (uap->fd != -1 || pos != 0)))
return (EINVAL);
if (flags & MAP_STACK) {
@@ -300,7 +300,6 @@ mmap(td, uap)
handle = NULL;
handle_type = OBJT_DEFAULT;
maxprot = VM_PROT_ALL;
- pos = 0;
} else {
/*
* Mapping file, get fp for validation and
OpenPOWER on IntegriCloud