aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2018-06-13 18:48:26 -0400
committerThomas Gleixner <tglx@linutronix.de>2018-06-20 13:10:00 -0400
commit17dbca119312b4e8173d4e25ff64262119fcef38 (patch)
treeed81f3bf900f83cdae9739415d0382b1fd303306 /drivers/base
parent10a70416e1f067f6c4efda6ffd8ea96002ac4223 (diff)
x86/speculation/l1tf: Add sysfs reporting for l1tf
L1TF core kernel workarounds are cheap and normally always enabled, However they still should be reported in sysfs if the system is vulnerable or mitigated. Add the necessary CPU feature/bug bits. - Extend the existing checks for Meltdowns to determine if the system is vulnerable. All CPUs which are not vulnerable to Meltdown are also not vulnerable to L1TF - Check for 32bit non PAE and emit a warning as there is no practical way for mitigation due to the limited physical address bits - If the system has more than MAX_PA/2 physical memory the invert page workarounds don't protect the system against the L1TF attack anymore, because an inverted physical address will also point to valid memory. Print a warning in this case and report that the system is vulnerable. Add a function which returns the PFN limit for the L1TF mitigation, which will be used in follow up patches for sanity and range checks. [ tglx: Renamed the CPU feature bit to L1TF_PTEINV ] Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com> Acked-by: Dave Hansen <dave.hansen@intel.com>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/cpu.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 30cc9c877ebb..eb9443d5bae1 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -540,16 +540,24 @@ ssize_t __weak cpu_show_spec_store_bypass(struct device *dev,
540 return sprintf(buf, "Not affected\n"); 540 return sprintf(buf, "Not affected\n");
541} 541}
542 542
543ssize_t __weak cpu_show_l1tf(struct device *dev,
544 struct device_attribute *attr, char *buf)
545{
546 return sprintf(buf, "Not affected\n");
547}
548
543static DEVICE_ATTR(meltdown, 0444, cpu_show_meltdown, NULL); 549static DEVICE_ATTR(meltdown, 0444, cpu_show_meltdown, NULL);
544static DEVICE_ATTR(spectre_v1, 0444, cpu_show_spectre_v1, NULL); 550static DEVICE_ATTR(spectre_v1, 0444, cpu_show_spectre_v1, NULL);
545static DEVICE_ATTR(spectre_v2, 0444, cpu_show_spectre_v2, NULL); 551static DEVICE_ATTR(spectre_v2, 0444, cpu_show_spectre_v2, NULL);
546static DEVICE_ATTR(spec_store_bypass, 0444, cpu_show_spec_store_bypass, NULL); 552static DEVICE_ATTR(spec_store_bypass, 0444, cpu_show_spec_store_bypass, NULL);
553static DEVICE_ATTR(l1tf, 0444, cpu_show_l1tf, NULL);
547 554
548static struct attribute *cpu_root_vulnerabilities_attrs[] = { 555static struct attribute *cpu_root_vulnerabilities_attrs[] = {
549 &dev_attr_meltdown.attr, 556 &dev_attr_meltdown.attr,
550 &dev_attr_spectre_v1.attr, 557 &dev_attr_spectre_v1.attr,
551 &dev_attr_spectre_v2.attr, 558 &dev_attr_spectre_v2.attr,
552 &dev_attr_spec_store_bypass.attr, 559 &dev_attr_spec_store_bypass.attr,
560 &dev_attr_l1tf.attr,
553 NULL 561 NULL
554}; 562};
555 563