From 5aaa5bc3d60716e8465035c0cb708380f070cfba Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Wed, 9 May 2018 12:03:40 +0000 Subject: [PATCH] Remove PG_U from the recursive pte for kernel pmap' PML4 page. This PML4 page is never used for the userspace process, so there is no security implications. But the configuration trips SMAP check, which should be corrected. Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/amd64/amd64/pmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 653678c9b389..9c8636d09c1c 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -1060,7 +1060,7 @@ create_pagetables(vm_paddr_t *firstaddr) /* And recursively map PML4 to itself in order to get PTmap */ p4_p = (pml4_entry_t *)KPML4phys; p4_p[PML4PML4I] = KPML4phys; - p4_p[PML4PML4I] |= X86_PG_RW | X86_PG_V | PG_U | pg_nx; + p4_p[PML4PML4I] |= X86_PG_RW | X86_PG_V | pg_nx; /* Connect the Direct Map slot(s) up to the PML4. */ for (i = 0; i < ndmpdpphys; i++) {