From owner-svn-src-head@FreeBSD.ORG Tue Jul 14 19:45:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2FD3B1065670; Tue, 14 Jul 2009 19:45:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1DFC38FC1E; Tue, 14 Jul 2009 19:45:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6EJjbfh069359; Tue, 14 Jul 2009 19:45:37 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6EJjaMC069356; Tue, 14 Jul 2009 19:45:36 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200907141945.n6EJjaMC069356@svn.freebsd.org> From: John Baldwin Date: Tue, 14 Jul 2009 19:45:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195693 - in head: lib/libc/sys sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jul 2009 19:45:37 -0000 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);