git: 66e63d0cad4d - stable/13 - amd64: Zero the PML5 PTI page when initializing a pmap

From: Mark Johnston <>
Date: Mon, 25 Oct 2021 12:47:45 UTC
The branch stable/13 has been updated by markj:


commit 66e63d0cad4d92cca747a2f62517ca34a126bef2
Author:     Mark Johnston <>
AuthorDate: 2021-10-18 13:29:20 +0000
Commit:     Mark Johnston <>
CommitDate: 2021-10-25 12:46:43 +0000

    amd64: Zero the PML5 PTI page when initializing a pmap
    The root page is not zeroed at allocation time since with 4-level tables
    each entry is copied from a template.  However, with 5-level tables only
    a single entry is filled, so the rest need to be cleared.
    Reported by:    alc
    Reviewed by:    alc, kib
    Sponsored by:   The FreeBSD Foundation
    (cherry picked from commit b0423d0f5eec89bd6c11c32649603031e3dbbfe1)
 sys/amd64/amd64/pmap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 83f2a4c88bf7..43ed0f7b7411 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -4186,6 +4186,7 @@ pmap_pinit_pml5_pti(vm_page_t pml5pgu)
 	pml5_entry_t *pm_pml5u;
 	pm_pml5u = (pml5_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(pml5pgu));
+	pagezero(pm_pml5u);
 	 * Add pml5 entry at top of KVA pointing to existing pml4 pti