From owner-svn-src-stable-8@FreeBSD.ORG Thu Sep 30 04:06:16 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA9F21065670; Thu, 30 Sep 2010 04:06:16 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D90CE8FC0A; Thu, 30 Sep 2010 04:06:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8U46Ggp052069; Thu, 30 Sep 2010 04:06:16 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8U46GKM052067; Thu, 30 Sep 2010 04:06:16 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009300406.o8U46GKM052067@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 30 Sep 2010 04:06:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213292 - stable/8/sys/boot/ofw/libofw X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2010 04:06:17 -0000 Author: nwhitehorn Date: Thu Sep 30 04:06:16 2010 New Revision: 213292 URL: http://svn.freebsd.org/changeset/base/213292 Log: MFC r212165: In the case of non-sequential mappings, ofw_mapmem() could ask Open Firmware to map a memory region with negative length, causing crashes and Undefined Behavior. Add the appropriate check to make the behavior defined. Modified: stable/8/sys/boot/ofw/libofw/ofw_copy.c Directory Properties: 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/sys/boot/ofw/libofw/ofw_copy.c ============================================================================== --- stable/8/sys/boot/ofw/libofw/ofw_copy.c Thu Sep 30 04:03:14 2010 (r213291) +++ stable/8/sys/boot/ofw/libofw/ofw_copy.c Thu Sep 30 04:06:16 2010 (r213292) @@ -68,7 +68,7 @@ ofw_mapmem(vm_offset_t dest, const size_ /* * Trim area covered by existing mapping, if any */ - if (dest < (last_dest + last_len)) { + if (dest < (last_dest + last_len) && dest >= last_dest) { nlen -= (last_dest + last_len) - dest; dest = last_dest + last_len; }