2019-10-24 21:51:45 +00:00
|
|
|
From: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
|
|
|
|
Date: Wed, 23 Oct 2019 12:19:51 +0200
|
|
|
|
Subject: x86/speculation/taa: Add sysfs reporting for TSX Async Abort
|
2019-10-20 13:46:03 +00:00
|
|
|
|
2019-11-07 18:04:08 +00:00
|
|
|
commit 6608b45ac5ecb56f9e171252229c39580cc85f0f upstream.
|
|
|
|
|
2019-10-20 13:46:03 +00:00
|
|
|
Add the sysfs reporting file for TSX Async Abort. It exposes the
|
|
|
|
vulnerability and the mitigation state similar to the existing files for
|
|
|
|
the other hardware vulnerabilities.
|
|
|
|
|
2019-10-24 21:51:45 +00:00
|
|
|
Sysfs file path is:
|
2019-10-20 13:46:03 +00:00
|
|
|
/sys/devices/system/cpu/vulnerabilities/tsx_async_abort
|
|
|
|
|
|
|
|
Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
|
2019-10-24 21:51:45 +00:00
|
|
|
Signed-off-by: Borislav Petkov <bp@suse.de>
|
2019-11-07 18:04:08 +00:00
|
|
|
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
|
|
|
Tested-by: Neelima Krishnan <neelima.krishnan@intel.com>
|
2019-10-20 13:46:03 +00:00
|
|
|
Reviewed-by: Mark Gross <mgross@linux.intel.com>
|
|
|
|
Reviewed-by: Tony Luck <tony.luck@intel.com>
|
2019-11-07 18:04:08 +00:00
|
|
|
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
|
|
|
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
|
2019-10-20 13:46:03 +00:00
|
|
|
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
|
|
|
|
---
|
|
|
|
arch/x86/kernel/cpu/bugs.c | 23 +++++++++++++++++++++++
|
|
|
|
drivers/base/cpu.c | 9 +++++++++
|
|
|
|
include/linux/cpu.h | 3 +++
|
|
|
|
3 files changed, 35 insertions(+)
|
|
|
|
|
|
|
|
--- a/arch/x86/kernel/cpu/bugs.c
|
|
|
|
+++ b/arch/x86/kernel/cpu/bugs.c
|
2019-11-07 18:04:08 +00:00
|
|
|
@@ -1408,6 +1408,21 @@ static ssize_t mds_show_state(char *buf)
|
2019-10-20 13:46:03 +00:00
|
|
|
sched_smt_active() ? "vulnerable" : "disabled");
|
|
|
|
}
|
|
|
|
|
|
|
|
+static ssize_t tsx_async_abort_show_state(char *buf)
|
|
|
|
+{
|
2019-10-24 21:51:45 +00:00
|
|
|
+ if ((taa_mitigation == TAA_MITIGATION_TSX_DISABLED) ||
|
2019-10-20 13:46:03 +00:00
|
|
|
+ (taa_mitigation == TAA_MITIGATION_OFF))
|
|
|
|
+ return sprintf(buf, "%s\n", taa_strings[taa_mitigation]);
|
|
|
|
+
|
|
|
|
+ if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) {
|
|
|
|
+ return sprintf(buf, "%s; SMT Host state unknown\n",
|
|
|
|
+ taa_strings[taa_mitigation]);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return sprintf(buf, "%s; SMT %s\n", taa_strings[taa_mitigation],
|
|
|
|
+ sched_smt_active() ? "vulnerable" : "disabled");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
static char *stibp_state(void)
|
|
|
|
{
|
|
|
|
if (spectre_v2_enabled == SPECTRE_V2_IBRS_ENHANCED)
|
2019-11-07 18:04:08 +00:00
|
|
|
@@ -1476,6 +1491,9 @@ static ssize_t cpu_show_common(struct de
|
|
|
|
case X86_BUG_MDS:
|
|
|
|
return mds_show_state(buf);
|
2019-10-20 13:46:03 +00:00
|
|
|
|
|
|
|
+ case X86_BUG_TAA:
|
|
|
|
+ return tsx_async_abort_show_state(buf);
|
|
|
|
+
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2019-11-07 18:04:08 +00:00
|
|
|
@@ -1512,4 +1530,9 @@ ssize_t cpu_show_mds(struct device *dev,
|
2019-10-20 13:46:03 +00:00
|
|
|
{
|
2019-11-07 18:04:08 +00:00
|
|
|
return cpu_show_common(dev, attr, buf, X86_BUG_MDS);
|
2019-10-20 13:46:03 +00:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ssize_t cpu_show_tsx_async_abort(struct device *dev, struct device_attribute *attr, char *buf)
|
|
|
|
+{
|
|
|
|
+ return cpu_show_common(dev, attr, buf, X86_BUG_TAA);
|
|
|
|
+}
|
|
|
|
#endif
|
|
|
|
--- a/drivers/base/cpu.c
|
|
|
|
+++ b/drivers/base/cpu.c
|
2019-11-07 18:04:08 +00:00
|
|
|
@@ -552,12 +552,20 @@ ssize_t __weak cpu_show_mds(struct devic
|
2019-10-20 13:46:03 +00:00
|
|
|
return sprintf(buf, "Not affected\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
+ssize_t __weak cpu_show_tsx_async_abort(struct device *dev,
|
|
|
|
+ struct device_attribute *attr,
|
|
|
|
+ char *buf)
|
|
|
|
+{
|
|
|
|
+ return sprintf(buf, "Not affected\n");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
static DEVICE_ATTR(meltdown, 0444, cpu_show_meltdown, NULL);
|
|
|
|
static DEVICE_ATTR(spectre_v1, 0444, cpu_show_spectre_v1, NULL);
|
|
|
|
static DEVICE_ATTR(spectre_v2, 0444, cpu_show_spectre_v2, NULL);
|
2019-11-07 18:04:08 +00:00
|
|
|
static DEVICE_ATTR(spec_store_bypass, 0444, cpu_show_spec_store_bypass, NULL);
|
2019-10-20 13:46:03 +00:00
|
|
|
static DEVICE_ATTR(l1tf, 0444, cpu_show_l1tf, NULL);
|
|
|
|
static DEVICE_ATTR(mds, 0444, cpu_show_mds, NULL);
|
|
|
|
+static DEVICE_ATTR(tsx_async_abort, 0444, cpu_show_tsx_async_abort, NULL);
|
|
|
|
|
|
|
|
static struct attribute *cpu_root_vulnerabilities_attrs[] = {
|
|
|
|
&dev_attr_meltdown.attr,
|
2019-11-07 18:04:08 +00:00
|
|
|
@@ -566,6 +574,7 @@ static struct attribute *cpu_root_vulner
|
|
|
|
&dev_attr_spec_store_bypass.attr,
|
2019-10-20 13:46:03 +00:00
|
|
|
&dev_attr_l1tf.attr,
|
|
|
|
&dev_attr_mds.attr,
|
|
|
|
+ &dev_attr_tsx_async_abort.attr,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
--- a/include/linux/cpu.h
|
|
|
|
+++ b/include/linux/cpu.h
|
2019-11-07 18:04:08 +00:00
|
|
|
@@ -59,6 +59,9 @@ extern ssize_t cpu_show_l1tf(struct devi
|
|
|
|
struct device_attribute *attr, char *buf);
|
|
|
|
extern ssize_t cpu_show_mds(struct device *dev,
|
2019-10-20 13:46:03 +00:00
|
|
|
struct device_attribute *attr, char *buf);
|
|
|
|
+extern ssize_t cpu_show_tsx_async_abort(struct device *dev,
|
|
|
|
+ struct device_attribute *attr,
|
|
|
|
+ char *buf);
|
|
|
|
|
|
|
|
extern __printf(4, 5)
|
|
|
|
struct device *cpu_device_create(struct device *parent, void *drvdata,
|