Date: Tue, 14 Jul 2009 19:45:36 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r195693 - in head: lib/libc/sys sys/vm Message-ID: <200907141945.n6EJjaMC069356@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Tue Jul 14 19:45:36 2009 New Revision: 195693 URL: http://svn.freebsd.org/changeset/base/195693 Log: - Change mmap() to fail requests with EINVAL that pass a length of 0. This behavior is mandated by POSIX. - Do not fail requests that pass a length greater than SSIZE_MAX (such as > 2GB on 32-bit platforms). The 'len' parameter is actually an unsigned 'size_t' so negative values don't really make sense. Submitted by: Alexander Best alexbestms at math.uni-muenster.de Reviewed by: alc Approved by: re (kib) MFC after: 1 week Modified: head/lib/libc/sys/mmap.2 head/sys/vm/vm_mmap.c Modified: head/lib/libc/sys/mmap.2 ============================================================================== --- head/lib/libc/sys/mmap.2 Tue Jul 14 19:37:53 2009 (r195692) +++ head/lib/libc/sys/mmap.2 Tue Jul 14 19:45:36 2009 (r195693) @@ -28,7 +28,7 @@ .\" @(#)mmap.2 8.4 (Berkeley) 5/11/95 .\" $FreeBSD$ .\" -.Dd October 24, 2008 +.Dd July 14, 2009 .Dt MMAP 2 .Os .Sh NAME @@ -306,7 +306,7 @@ resides out of the valid address space f The .Fa len argument -was negative. +was equal to zero. .It Bq Er EINVAL .Dv MAP_ANON was specified and the Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Tue Jul 14 19:37:53 2009 (r195692) +++ head/sys/vm/vm_mmap.c Tue Jul 14 19:45:36 2009 (r195693) @@ -229,7 +229,7 @@ mmap(td, uap) fp = NULL; /* make sure mapping fits into numeric range etc */ - if ((ssize_t) uap->len < 0 || + if (uap->len == 0 || ((flags & MAP_ANON) && uap->fd != -1)) return (EINVAL);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907141945.n6EJjaMC069356>