diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 2989eb40059..54a733c9c1f 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -106,6 +106,7 @@ __FBSDID("$FreeBSD$"); * and to when physical maps must be made correct. */ +#include "opt_pax.h" #include "opt_pmap.h" #include "opt_vm.h" @@ -414,7 +415,12 @@ int invpcid_works = 0; SYSCTL_INT(_vm_pmap, OID_AUTO, invpcid_works, CTLFLAG_RD, &invpcid_works, 0, "Is the invpcid instruction available ?"); +#ifdef PAX +/* The related part of code is in x86/identcpu.c - see pti_get_default() */ +int pti = 1; +#else int pti = 0; +#endif SYSCTL_INT(_vm_pmap, OID_AUTO, pti, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &pti, 0, "Page Table Isolation enabled"); diff --git a/sys/x86/x86/identcpu.c b/sys/x86/x86/identcpu.c index dd580375454..8b48855639e 100644 --- a/sys/x86/x86/identcpu.c +++ b/sys/x86/x86/identcpu.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include "opt_cpu.h" +#include "opt_pax.h" #include #include @@ -1596,11 +1597,15 @@ int pti_get_default(void) { +#ifdef PAX + return (1); +#else if (strcmp(cpu_vendor, AMD_VENDOR_ID) == 0) return (0); if ((cpu_ia32_arch_caps & IA32_ARCH_CAP_RDCL_NO) != 0) return (0); return (1); +#endif } static u_int