From owner-svn-src-all@FreeBSD.ORG Sat Feb 15 13:20:18 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6408DA54; Sat, 15 Feb 2014 13:20:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4FFD51667; Sat, 15 Feb 2014 13:20:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s1FDKIqI017969; Sat, 15 Feb 2014 13:20:18 GMT (envelope-from zbb@svn.freebsd.org) Received: (from zbb@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s1FDKIM7017968; Sat, 15 Feb 2014 13:20:18 GMT (envelope-from zbb@svn.freebsd.org) Message-Id: <201402151320.s1FDKIM7017968@svn.freebsd.org> From: Zbigniew Bodek Date: Sat, 15 Feb 2014 13:20:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r261919 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Feb 2014 13:20:18 -0000 Author: zbb Date: Sat Feb 15 13:20:17 2014 New Revision: 261919 URL: http://svnweb.freebsd.org/changeset/base/261919 Log: Fix superpage promotion on ARM with respect to RO/RW and wired attributes It was possible to create RW superpage mapping even if the base pages were RO due to wrong setting of the prot flag passed to pmap_map_section(). Promotion attempt should be canceled in case of attributes mismatch between any two base pages. Since we still use pv_flags to maintain permission to write (PVF_WRITE) and wired status (PVF_WIRED) for a page, it is also necessary to take those variables into account. Modified: head/sys/arm/arm/pmap-v6.c Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Sat Feb 15 13:17:51 2014 (r261918) +++ head/sys/arm/arm/pmap-v6.c Sat Feb 15 13:20:17 2014 (r261919) @@ -3794,10 +3794,13 @@ pmap_promote_section(pmap_t pmap, vm_off * we just configure protections for the section mapping * that is going to be created. */ - if (!L2_S_WRITABLE(firstpte) && (first_pve->pv_flags & PVF_WRITE)) { - first_pve->pv_flags &= ~PVF_WRITE; + if ((first_pve->pv_flags & PVF_WRITE) != 0) { + if (!L2_S_WRITABLE(firstpte)) { + first_pve->pv_flags &= ~PVF_WRITE; + prot &= ~VM_PROT_WRITE; + } + } else prot &= ~VM_PROT_WRITE; - } if (!L2_S_EXECUTABLE(firstpte)) prot &= ~VM_PROT_EXECUTE; @@ -3842,6 +3845,12 @@ pmap_promote_section(pmap_t pmap, vm_off if (!L2_S_WRITABLE(oldpte) && (pve->pv_flags & PVF_WRITE)) pve->pv_flags &= ~PVF_WRITE; + if (pve->pv_flags != first_pve->pv_flags) { + pmap_section_p_failures++; + CTR2(KTR_PMAP, "pmap_promote_section: failure for " + "va %#x in pmap %p", va, pmap); + return; + } old_va -= PAGE_SIZE; pa -= PAGE_SIZE;