From owner-svn-src-all@freebsd.org Fri Sep 18 12:30:40 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 455923E26CF; Fri, 18 Sep 2020 12:30:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BtCq41BYyz4WQp; Fri, 18 Sep 2020 12:30:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C5A11B17D; Fri, 18 Sep 2020 12:30:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 08ICUdvY069108; Fri, 18 Sep 2020 12:30:39 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 08ICUdcl069107; Fri, 18 Sep 2020 12:30:39 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202009181230.08ICUdcl069107@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 18 Sep 2020 12:30:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r365878 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 365878 X-SVN-Commit-Repository: base 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.33 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: Fri, 18 Sep 2020 12:30:40 -0000 Author: markj Date: Fri Sep 18 12:30:39 2020 New Revision: 365878 URL: https://svnweb.freebsd.org/changeset/base/365878 Log: Ensure that a protection key is selected in pmap_enter_largepage(). Reviewed by: alc, kib Reported by: Coverity MFC with: r365518 Differential Revision: https://reviews.freebsd.org/D26464 Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Fri Sep 18 12:30:15 2020 (r365877) +++ head/sys/amd64/amd64/pmap.c Fri Sep 18 12:30:39 2020 (r365878) @@ -6537,14 +6537,14 @@ restart: mp->ref_count++; } KASSERT((origpte & PG_V) == 0 || ((origpte & PG_PS) != 0 && - (origpte & PG_FRAME) == (newpte & PG_FRAME)), - ("va %#lx changing 1G phys page pdpe %#lx newpte %#lx", - va, origpte, newpte)); - if ((newpte & PG_W) != 0 && (origpte & PG_W) == 0) + (origpte & PG_FRAME) == (pten & PG_FRAME)), + ("va %#lx changing 1G phys page pdpe %#lx pten %#lx", + va, origpte, pten)); + if ((pten & PG_W) != 0 && (origpte & PG_W) == 0) pmap->pm_stats.wired_count += NBPDP / PAGE_SIZE; - else if ((newpte & PG_W) == 0 && (origpte & PG_W) != 0) + else if ((pten & PG_W) == 0 && (origpte & PG_W) != 0) pmap->pm_stats.wired_count -= NBPDP / PAGE_SIZE; - *pdpe = newpte; + *pdpe = pten; } else /* (psind == 1) */ { /* 2M */ if (!pmap_pkru_same(pmap, va, va + NBPDR)) return (KERN_PROTECTION_FAILURE); @@ -6573,14 +6573,14 @@ restart: mp->ref_count++; } KASSERT((origpte & PG_V) == 0 || ((origpte & PG_PS) != 0 && - (origpte & PG_FRAME) == (newpte & PG_FRAME)), - ("va %#lx changing 2M phys page pde %#lx newpte %#lx", - va, origpte, newpte)); - if ((newpte & PG_W) != 0 && (origpte & PG_W) == 0) + (origpte & PG_FRAME) == (pten & PG_FRAME)), + ("va %#lx changing 2M phys page pde %#lx pten %#lx", + va, origpte, pten)); + if ((pten & PG_W) != 0 && (origpte & PG_W) == 0) pmap->pm_stats.wired_count += NBPDR / PAGE_SIZE; - else if ((newpte & PG_W) == 0 && (origpte & PG_W) != 0) + else if ((pten & PG_W) == 0 && (origpte & PG_W) != 0) pmap->pm_stats.wired_count -= NBPDR / PAGE_SIZE; - *pde = newpte; + *pde = pten; } if ((origpte & PG_V) == 0) pmap_resident_count_inc(pmap, pagesizes[psind] / PAGE_SIZE);