Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Jun 2021 20:25:31 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: fa3cfd1a845a - stable/13 - arm64: Fix pmap_copy()'s handling of 2MB mappings
Message-ID:  <202106142025.15EKPVgP073364@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=fa3cfd1a845a33dbee88fcd80599c3ecc3268e26

commit fa3cfd1a845a33dbee88fcd80599c3ecc3268e26
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-06-06 20:40:45 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-06-14 20:25:15 +0000

    arm64: Fix pmap_copy()'s handling of 2MB mappings
    
    When copying mappings from parent to child, we clear the accessed and
    dirty bits.  This is done for both 4KB and 2MB PTEs.  However,
    pmap_demote_l2() asserts that writable superpages must be dirty.  This
    is to avoid races with the MMU setting the dirty bit during promotion
    and demotion.  pmap_copy() can create clean, writable superpage
    mappings, so it violates this assertion.
    
    Modify pmap_copy() to preserve the accessed and dirty bits when copying
    2MB mappings, like we do on amd64.
    
    Fixes:          ca2cae0b4dd
    Reported by:    Jenkins via mhorne
    Reviewed by:    alc, kib
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D30643
    
    (cherry picked from commit 4e4035ef1fb5e2f9da6b658ffae8a54862b4d018)
---
 sys/arm64/arm64/pmap.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
index b49ec4194e19..e9dd27981d61 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -4751,11 +4751,8 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len,
 			    ((srcptepaddr & ATTR_SW_MANAGED) == 0 ||
 			    pmap_pv_insert_l2(dst_pmap, addr, srcptepaddr,
 			    PMAP_ENTER_NORECLAIM, &lock))) {
-				mask = ATTR_AF | ATTR_SW_WIRED;
-				nbits = 0;
-				if ((srcptepaddr & ATTR_SW_DBM) != 0)
-					nbits |= ATTR_S1_AP_RW_BIT;
-				pmap_store(l2, (srcptepaddr & ~mask) | nbits);
+				mask = ATTR_SW_WIRED;
+				pmap_store(l2, srcptepaddr & ~mask);
 				pmap_resident_count_inc(dst_pmap, L2_SIZE /
 				    PAGE_SIZE);
 				atomic_add_long(&pmap_l2_mappings, 1);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106142025.15EKPVgP073364>