From nobody Tue Dec 14 10:44:27 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 74FA118D6E47; Tue, 14 Dec 2021 10:44:28 +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 4JCw3w1SLFz3Hdc; Tue, 14 Dec 2021 10:44:28 +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 126E0268D8; Tue, 14 Dec 2021 10:44:28 +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 1BEAiR0v012442; Tue, 14 Dec 2021 10:44:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BEAiRid012441; Tue, 14 Dec 2021 10:44:27 GMT (envelope-from git) Date: Tue, 14 Dec 2021 10:44:27 GMT Message-Id: <202112141044.1BEAiRid012441@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 6238905c5b25 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 6238905c5b253c5b8c6a4b66796819c3a0bed637 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639478668; 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=O9TNdZI8ghIamwhpxBjLHFsX7ttCcOeaTOEPyQ81PLY=; b=ECVKNQGb/PSlHaQro4APXKx4do59tYpIGC1kvD7A9JMH2Hb3eS4L7a44ebXu0suLSR35R2 QcgCBC3FsrqminD02A0gPFvkikxqRT94SG2TGBPur6J/Xn7O0AjQbswKNQCM/pFDjvvomc gWyIBFp+k0XVvPKdOvd2vY3of8am6zGf0aIQT/K7AWRi6YVTvzRiGqbXb3z0qr5w5fmU+z Pu8ztfsuJ1ymvgQ+PVc827zgmawv4lz2PNLqVn2QukFtSRIbhmCOE/Sw17FzQU1FRDYD1r bH6sn2f/d5Py/1Z60GEJSpIKM0+RPv4OJcPYWM2Coke5IzEg/ArgAVlWCZxc/Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639478668; a=rsa-sha256; cv=none; b=g9FEuKlNQKVi1TpuWsWamgPAF/KIUgT+MXlw7YtsXFbVTDD2uc7Peu6avcOjMOylJCoQcJ nGLTJFgi6hNl+uCI3s7ZFHjG8JsyAgdHBmFb2miG6dfLiFuYnxODtv3ujT2/9b1jm7EOHd e127Xo0wkz22vWaZYYjdhSJFnuDYzAxbIAqpt/Cx58Uv0m2pyaD7eDvQ0k+qMJpeDKYV7d VbH0MPseVlhPh1t50d3c8PlRtVrLYhiLHbUq0sDSTQyJWsKGy7S5Io4dknQAMwSQ+gTKE+ QDBEvR+Iw/yxY0n5XeawBDAGp4b64gmgGRt2rm8LdmdrQoVUEFLt/sn1mx00tA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=6238905c5b253c5b8c6a4b66796819c3a0bed637 commit 6238905c5b253c5b8c6a4b66796819c3a0bed637 Author: Andrew Turner AuthorDate: 2021-12-14 10:05:15 +0000 Commit: Andrew Turner CommitDate: 2021-12-14 10:38:19 +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 --- 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 7763e1eabdda..d50c544cc863 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -5970,6 +5970,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; @@ -6083,12 +6084,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);