amd64 pmap: Pre-set PG_M on 2MB KASAN shadow map entries

Also remove a redundant assertion in pmap_kasan_enter().

Reviewed by:	alc, kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31295
This commit is contained in:
Mark Johnston 2021-08-10 16:23:42 -04:00
parent 805c3af898
commit 4fd450a87d

View File

@ -11321,7 +11321,7 @@ pmap_kasan_enter(vm_offset_t va)
m = pmap_kasan_enter_alloc_2m(); m = pmap_kasan_enter_alloc_2m();
if (m != NULL) { if (m != NULL) {
*pde = (pd_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW | *pde = (pd_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW |
X86_PG_PS | X86_PG_V | pg_nx); X86_PG_PS | X86_PG_V | X86_PG_A | X86_PG_M | pg_nx);
} else { } else {
m = pmap_kasan_enter_alloc_4k(); m = pmap_kasan_enter_alloc_4k();
*pde = (pd_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW | *pde = (pd_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW |
@ -11333,8 +11333,6 @@ pmap_kasan_enter(vm_offset_t va)
pte = pmap_pde_to_pte(pde, va); pte = pmap_pde_to_pte(pde, va);
if ((*pte & X86_PG_V) != 0) if ((*pte & X86_PG_V) != 0)
return; return;
KASSERT((*pte & X86_PG_V) == 0,
("%s: shadow address %#lx is already mapped", __func__, va));
m = pmap_kasan_enter_alloc_4k(); m = pmap_kasan_enter_alloc_4k();
*pte = (pt_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW | X86_PG_V | *pte = (pt_entry_t)(VM_PAGE_TO_PHYS(m) | X86_PG_RW | X86_PG_V |
X86_PG_M | X86_PG_A | pg_nx); X86_PG_M | X86_PG_A | pg_nx);