svn commit: r206602 - in stable/8: lib/libc/sys sys/vm
John Baldwin
jhb at FreeBSD.org
Wed Apr 14 15:22:59 UTC 2010
Author: jhb
Date: Wed Apr 14 15:22:58 2010
New Revision: 206602
URL: http://svn.freebsd.org/changeset/base/206602
Log:
MFC 205536:
Reject attempts to create a MAP_ANON mapping with a non-zero offset.
Modified:
stable/8/lib/libc/sys/mmap.2
stable/8/sys/vm/vm_mmap.c
Directory Properties:
stable/8/lib/libc/ (props changed)
stable/8/lib/libc/stdtime/ (props changed)
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
stable/8/sys/dev/xen/xenpci/ (props changed)
Modified: stable/8/lib/libc/sys/mmap.2
==============================================================================
--- stable/8/lib/libc/sys/mmap.2 Wed Apr 14 15:20:30 2010 (r206601)
+++ stable/8/lib/libc/sys/mmap.2 Wed Apr 14 15:22:58 2010 (r206602)
@@ -105,7 +105,7 @@ The file descriptor used for creating
must be \-1.
The
.Fa offset
-argument is ignored.
+argument must be 0.
.\".It Dv MAP_FILE
.\"Mapped from a regular file or character-special device memory.
.It Dv MAP_FIXED
@@ -312,6 +312,11 @@ was equal to zero.
was specified and the
.Fa fd
argument was not -1.
+.It Bq Er EINVAL
+.Dv MAP_ANON
+was specified and the
+.Fa offset
+argument was not 0.
.It Bq Er ENODEV
.Dv MAP_ANON
has not been specified and
Modified: stable/8/sys/vm/vm_mmap.c
==============================================================================
--- stable/8/sys/vm/vm_mmap.c Wed Apr 14 15:20:30 2010 (r206601)
+++ stable/8/sys/vm/vm_mmap.c Wed Apr 14 15:22:58 2010 (r206602)
@@ -232,7 +232,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) {
@@ -298,7 +298,6 @@ mmap(td, uap)
handle = NULL;
handle_type = OBJT_DEFAULT;
maxprot = VM_PROT_ALL;
- pos = 0;
} else {
/*
* Mapping file, get fp for validation and
More information about the svn-src-stable-8
mailing list