[PATCH] SYSFS reporting of L1TF on PowerPC.

From: Anthony Steinhauser
Date: Wed Oct 23 2019 - 19:04:37 EST


L1TF affects PowerPC of the same range as Meltdown-US.
I tested it personally:
https://github.com/google/safeside/pull/52
and it is also admitted in the IBM report:
https://www.ibm.com/blogs/psirt/potential-impact-processors-power-family/
Similarly to Meltdown it is effectively mitigated by the rfi_flush.

Signed-off-by: Anthony Steinhauser <asteinhauser@xxxxxxxxxx>
---
arch/powerpc/kernel/security.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/arch/powerpc/kernel/security.c b/arch/powerpc/kernel/security.c
index 7cfcb294b11c..410232e79371 100644
--- a/arch/powerpc/kernel/security.c
+++ b/arch/powerpc/kernel/security.c
@@ -167,6 +167,18 @@ ssize_t cpu_show_meltdown(struct device *dev, struct device_attribute *attr, cha

return sprintf(buf, "Vulnerable\n");
}
+
+ssize_t cpu_show_l1tf(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ if (rfi_flush)
+ return sprintf(buf, "Mitigation: RFI Flush");
+
+ if (!security_ftr_enabled(SEC_FTR_L1D_FLUSH_HV) &&
+ !security_ftr_enabled(SEC_FTR_L1D_FLUSH_PR))
+ return sprintf(buf, "Not affected\n");
+
+ return sprintf(buf, "Vulnerable\n");
+}
#endif

ssize_t cpu_show_spectre_v1(struct device *dev, struct device_attribute *attr, char *buf)
--
2.23.0.866.gb869b98d4c-goog