From 23084818ff0f840888490236a1a95bacd11a2a81 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Sat, 14 Apr 2018 17:33:16 +0000 Subject: [PATCH] Set PG_G global mapping bit on the trampoline ptes. Trampoline mappings are better treated as global since they are valid in all address spaces, even for PTI. pmap_invalidate_range() must work on global mappings for pti since kernel_pmap invalidations are really same as for non-PTI. Reviewed by: alc, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 month Differential revision: https://reviews.freebsd.org/D15052 --- 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 c99b11a34416..ea1a7e2f9c6f 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -8000,7 +8000,7 @@ pmap_pti_add_kva_locked(vm_offset_t sva, vm_offset_t eva, bool exec) for (; sva < eva; sva += PAGE_SIZE) { pte = pmap_pti_pte(sva, &unwire_pde); pa = pmap_kextract(sva); - ptev = pa | X86_PG_RW | X86_PG_V | X86_PG_A | + ptev = pa | X86_PG_RW | X86_PG_V | X86_PG_A | X86_PG_G | (exec ? 0 : pg_nx) | pmap_cache_bits(kernel_pmap, VM_MEMATTR_DEFAULT, FALSE); if (*pte == 0) {