From nobody Wed Dec 29 10:16:48 2021 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 F3AC51923F13; Wed, 29 Dec 2021 10:16:48 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JP6l43YjNz4ms3; Wed, 29 Dec 2021 10:16:48 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 555DD2327D; Wed, 29 Dec 2021 10:16:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BTAGmV0061112; Wed, 29 Dec 2021 10:16:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BTAGmPb061111; Wed, 29 Dec 2021 10:16:48 GMT (envelope-from git) Date: Wed, 29 Dec 2021 10:16:48 GMT Message-Id: <202112291016.1BTAGmPb061111@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 2601c0521063 - stable/13 - Only change DMAP props on DMAP covered memory 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2601c05210631bf7880b1c3aa22d3269d433259b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640773008; 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=73C6VEDkGJgluIdmX1q52CpNLUAMBjRln6bNPdGBFaU=; b=sC2G19pMMXPS4p50QoySi29pUU+WyuEfi/DfDRn/irc7jybZDher+b5ckRq3Xnr4MP2sVf D29c8cVTuJB0pfJnVvRb1UJVxkrhBYR2Ye+n84tvYrbYI8PkacMXl7L4qa/FOsMXhAQelY HGw2NLNgjhhrqcOZNagoZTH8jetypWZ6BiNTjR215j3kGQHfLRszTzFpjmPPevKW5Gcp+0 Ohok/lIIULBH2hsKdFE+ajwjJwUEydXjRSfET26WQaNceGP5HkLkr/un4TGLTSSNv+D+dG z3m1DICjexQ8mI/8anTxOsYgQdB1H6Rz3nxtbEFdGdciP6I6C+zmAKwmxCi0Cg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640773008; a=rsa-sha256; cv=none; b=NFOTiwGTJ8MdH1W9cVQ4kHics3PMMmwkkDL7JyigZXeoIVlFVyTU9XkQmwiQxYtrXeM9r6 sKw/9xzunA4D2HGLO1pe2zf/K6usDzHqYefs3jkZl2Yz3fNeoSQoMgmcrF7//euTsiXfRg Jf4+K4Ur1fc1atd8qKJ+bhEqk0hC8b/cJQG2cIwOH8BgDL9tImry7I5VmraYPPUSsuC6zj +nLDd5kVKpD+hlpmTBsbBGedRzcgZvT/n1dYQ3uCgUZ+0d2r9ZZAuUmXxHARp9WNwEllTE jgJ+JYP6H1Io7o8FsTMiuILfcexD46f3/MMQ3tKhAEP60NohppLt/KwOcNWm2w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=2601c05210631bf7880b1c3aa22d3269d433259b commit 2601c05210631bf7880b1c3aa22d3269d433259b Author: Andrew Turner AuthorDate: 2021-12-14 10:05:15 +0000 Commit: Andrew Turner CommitDate: 2021-12-29 10:05:09 +0000 Only change DMAP props on DMAP covered memory When changing memory properties in the arm64 pmap we need to keep both the kernel address and DMAP mappings in sync. To keep the kernel and DMAP memory in sync we recurse when updating the former to also update the latter. There was insuffucuent checking around this recursion. It would check if the virtual address is not within the DMAP region, but not if the physical address is covered. Add the missing check as without it the recursion may return an error. Sponsored by: The FreeBSD Foundation (cherry picked from commit 6238905c5b253c5b8c6a4b66796819c3a0bed637) --- sys/arm64/arm64/pmap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index f30a180612ef..793126fcf58d 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -6148,6 +6148,7 @@ pmap_change_props_locked(vm_offset_t va, vm_size_t size, vm_prot_t prot, { vm_offset_t base, offset, tmpva; vm_size_t pte_size; + vm_paddr_t pa; pt_entry_t pte, *ptep, *newpte; pt_entry_t bits, mask; int lvl, rv; @@ -6261,12 +6262,13 @@ pmap_change_props_locked(vm_offset_t va, vm_size_t size, vm_prot_t prot, pmap_update_entry(kernel_pmap, ptep, pte, tmpva, pte_size); - if (!VIRT_IN_DMAP(tmpva)) { + pa = pte & ~ATTR_MASK; + if (!VIRT_IN_DMAP(tmpva) && PHYS_IN_DMAP(pa)) { /* * Keep the DMAP memory in sync. */ rv = pmap_change_props_locked( - PHYS_TO_DMAP(pte & ~ATTR_MASK), pte_size, + PHYS_TO_DMAP(pa), pte_size, prot, mode); if (rv != 0) return (rv);