aboutsummaryrefslogtreecommitdiff
path: root/sys/x86
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2018-01-19 15:42:34 +0000
committerEd Maste <emaste@FreeBSD.org>2018-01-19 15:42:34 +0000
commitb3327f62f0cdabe91d36959001a065a1c3eb3d85 (patch)
treede8a73073ed11200ab06bab5ac50f11d0bdccbf1 /sys/x86
parent19641ce89346b161f242a10b23dc39d8e43bfbdd (diff)
downloadsrc-b3327f62f0cdabe91d36959001a065a1c3eb3d85.tar.gz
src-b3327f62f0cdabe91d36959001a065a1c3eb3d85.zip
Enable KPTI by default on amd64 for non-AMD CPUs
Kernel Page Table Isolation (KPTI) was introduced in r328083 as a mitigation for the 'Meltdown' vulnerability. AMD CPUs are not affected, per https://www.amd.com/en/corporate/speculative-execution: We believe AMD processors are not susceptible due to our use of privilege level protections within paging architecture and no mitigation is required. Thus default KPTI to off for AMD CPUs, and to on for others. This may be refined later as we obtain more specific information on the sets of CPUs that are and are not affected. Submitted by: Mitchell Horne Reviewed by: cem Relnotes: Yes Security: CVE-2017-5754 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D13971
Notes
Notes: svn path=/head/; revision=328166
Diffstat (limited to 'sys/x86')
-rw-r--r--sys/x86/include/x86_var.h1
-rw-r--r--sys/x86/x86/identcpu.c10
2 files changed, 11 insertions, 0 deletions
diff --git a/sys/x86/include/x86_var.h b/sys/x86/include/x86_var.h
index fd56277bc2e1..431ff11abdae 100644
--- a/sys/x86/include/x86_var.h
+++ b/sys/x86/include/x86_var.h
@@ -136,6 +136,7 @@ void nmi_call_kdb_smp(u_int type, struct trapframe *frame);
void nmi_handle_intr(u_int type, struct trapframe *frame);
void pagecopy(void *from, void *to);
void printcpuinfo(void);
+int pti_get_default(void);
int user_dbreg_trap(void);
int minidumpsys(struct dumperinfo *);
struct pcb *get_pcb_td(struct thread *td);
diff --git a/sys/x86/x86/identcpu.c b/sys/x86/x86/identcpu.c
index 896ee7cb11f5..20e9e1411745 100644
--- a/sys/x86/x86/identcpu.c
+++ b/sys/x86/x86/identcpu.c
@@ -1608,6 +1608,16 @@ finishidentcpu(void)
#endif
}
+int
+pti_get_default(void)
+{
+
+ if (strcmp(cpu_vendor, AMD_VENDOR_ID) == 0)
+ return (0);
+
+ return (1);
+}
+
static u_int
find_cpu_vendor_id(void)
{