From nobody Sun Jul 14 03:23:15 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WM9db5ynhz5Q1Xn; Sun, 14 Jul 2024 03:23:15 +0000 (UTC) (envelope-from git@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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WM9db5TgZz4t6L; Sun, 14 Jul 2024 03:23:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720927395; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=P1JBPpQaF84/9qWdUgqYCdYv9x/W65Q9T4cpgpT/cVA=; b=DbTt22f5iir93Oo5wbWRt1Se+ZHenxgAClSkIS9xLrK1ZOSgauUmi5MlPM5u9222ZpLlde 6bihqvKMrophEcrV214m39atwnchfsWcvhTbfnjf3cqC/ma7H5OB7V+XlNh9Nw9NHx7wQT 9iWUixFjR92o0WJIdgOY+TbEjsOxxprvyXvxSB4Ono5TLmevz+7r7IBTq4H57MoFRwcXcj IThvqq3BSN7EDGVotK9oYA4DZEYkFxFhCLJm8j5Y/2DxxbKUtly9VkN4T3CoUzdIsfxKlX N+ep64G5E/Y5KoHxxhmgctDClhlHd7UONRCEeVjacu9A/1rvb7Isizt/YQ6EAA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720927395; a=rsa-sha256; cv=none; b=Kg8IK33OeYLOWj+K5T811i5Jn/AbBgu6K7Pf+oNKy8rNzAP2yUbHS2Hb+bh+3BvJyVK7LX 7GYmYmusgfbSIwIMgZjzRljjl60ksGc25y0wX0fodpa7UwEeTyVc/z5lq8DKj1vZhV0csd z/9TBWe1AgqX/34Ol8aWIKaqR9avS/L3XnulUTntPVEuOE0HTps5uUJ2B6V8Yf/5/kwGg2 96wgV0/ETLb+S18pS7G8/3LHcxnI2d7Y7qxv8qwjdIQ9cJ2AHq2ezm7SALegDSIsEUFuAV /hJzI8O3dcUFC2Gmw2x6/KSMlh4QdsUY1z1RyxH2tau41MICwUMyj/GUfivJog== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720927395; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=P1JBPpQaF84/9qWdUgqYCdYv9x/W65Q9T4cpgpT/cVA=; b=iGSSnmOPoHWUXYVKt6/5mscGgYLCAmF1/P7BhNki73TdMZuQkqFzvf3D5ylDcIk3jjqSFU NqgIKka28ADWq3RCrmvJLx5s9dtK7dcKAc8ANeufzNz9pVT0iqSYdhxALaqEBbaEjrTSA1 E2ZaWPw+Glx2cTIlL+4i6rMiWvZYMU6KFGn9R4hDzOjbeLEzkQrsCynsgQ3vL1hdgv7t/S nwnn21eb8oe6z6KC6widn/O3af+B5c1M10QanM4eLtWWrzlPGqJfbi5oIk3jjjbXf3u+Iu l2zgHUt/4E+4owF11NJ7byTsY10rQ54j6HEmWZOEETw0Xqla1M3RmqOW7wTI+A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WM9db5329zsJM; Sun, 14 Jul 2024 03:23:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46E3NFNd079152; Sun, 14 Jul 2024 03:23:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46E3NF1Z079149; Sun, 14 Jul 2024 03:23:15 GMT (envelope-from git) Date: Sun, 14 Jul 2024 03:23:15 GMT Message-Id: <202407140323.46E3NF1Z079149@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 10a6ae0ddffb - main - amd64 pmap_allocpte_nosleep(): stop testing tautological condition List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 10a6ae0ddffb1de842a0ba6a6ca29786de6d3bfd Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=10a6ae0ddffb1de842a0ba6a6ca29786de6d3bfd commit 10a6ae0ddffb1de842a0ba6a6ca29786de6d3bfd Author: Konstantin Belousov AuthorDate: 2024-07-13 04:07:18 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-14 03:22:45 +0000 amd64 pmap_allocpte_nosleep(): stop testing tautological condition Enabled PTI for given pmap is equivalent to pm_ucr3 being valid is equivalent to root userspace page table page pm_pmltopu being allocated. Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D45966 --- sys/amd64/amd64/pmap.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 337edd646ca0..dcf9b4f5a4f3 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -4707,8 +4707,8 @@ pmap_allocpte_nosleep(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp, *pml5 = VM_PAGE_TO_PHYS(m) | PG_U | PG_RW | PG_V | PG_A | PG_M; if (pmap->pm_pmltopu != NULL && pml5index < NUPML5E) { - if (pmap->pm_ucr3 != PMAP_NO_CR3) - *pml5 |= pg_nx; + MPASS(pmap->pm_ucr3 != PMAP_NO_CR3); + *pml5 |= pg_nx; pml5u = &pmap->pm_pmltopu[pml5index]; *pml5u = VM_PAGE_TO_PHYS(m) | PG_U | PG_RW | PG_V | @@ -4728,6 +4728,8 @@ pmap_allocpte_nosleep(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp, if (!pmap_is_la57(pmap) && pmap->pm_pmltopu != NULL && pml4index < NUPML4E) { + MPASS(pmap->pm_ucr3 != PMAP_NO_CR3); + /* * PTI: Make all user-space mappings in the * kernel-mode page table no-execute so that @@ -4735,8 +4737,7 @@ pmap_allocpte_nosleep(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp, * the kernel-mode page table active on return * to user space. */ - if (pmap->pm_ucr3 != PMAP_NO_CR3) - *pml4 |= pg_nx; + *pml4 |= pg_nx; pml4u = &pmap->pm_pmltopu[pml4index]; *pml4u = VM_PAGE_TO_PHYS(m) | PG_U | PG_RW | PG_V |