git: 1bf4991bbc2c - main - Remove unneeded masks from the arm64 KASAN shadow

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Mon, 24 Apr 2023 11:34:09 UTC
The branch main has been updated by andrew:

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

commit 1bf4991bbc2c2fb6c33ce1303eff9c5833538034
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2023-04-21 15:28:36 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2023-04-24 11:33:50 +0000

    Remove unneeded masks from the arm64 KASAN shadow
    
    When mapping the arm64 KASAN shadow map we use Ln_TABLE_MASK to align
    physical addresses, however these should already be aligned either
    by rounding to a greater alignment, or the VM subsystem is giving us
    a correctly aligned page.
    
    Remove these extra alignment masks.
    
    Reviewed by:    kevans
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D39752
---
 sys/arm64/arm64/pmap.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
index fc4650c8d449..6bea9cde55b5 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -1241,8 +1241,7 @@ pmap_bootstrap_allocate_kasan_l2(vm_paddr_t start_pa, vm_paddr_t end_pa,
 			continue;
 		}
 
-		pmap_store(l2, (pa & ~Ln_TABLE_MASK) | PMAP_SAN_PTE_BITS |
-		    L2_BLOCK);
+		pmap_store(l2, pa | PMAP_SAN_PTE_BITS | L2_BLOCK);
 	}
 
 	/*
@@ -7800,8 +7799,7 @@ pmap_san_enter(vm_offset_t va)
 	MPASS(l1 != NULL);
 	if ((pmap_load(l1) & ATTR_DESCR_VALID) == 0) {
 		m = pmap_san_enter_alloc_l3();
-		pmap_store(l1, (VM_PAGE_TO_PHYS(m) & ~Ln_TABLE_MASK) |
-		    L1_TABLE);
+		pmap_store(l1, VM_PAGE_TO_PHYS(m) | L1_TABLE);
 	}
 	l2 = pmap_l1_to_l2(l1, va);
 	if ((pmap_load(l2) & ATTR_DESCR_VALID) == 0) {