Skip to content

Commit ff34835

Browse files
committed
powerpc/64s: Enhance the information in cpu_show_meltdown()
Now that we have the security feature flags we can make the information displayed in the "meltdown" file more informative. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent 8ad3304 commit ff34835

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

arch/powerpc/include/asm/security_features.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111

1212
extern unsigned long powerpc_security_features;
13+
extern bool rfi_flush;
1314

1415
static inline void security_ftr_set(unsigned long feature)
1516
{

arch/powerpc/kernel/security.c

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <linux/kernel.h>
88
#include <linux/device.h>
9+
#include <linux/seq_buf.h>
910

1011
#include <asm/security_features.h>
1112

@@ -19,8 +20,33 @@ unsigned long powerpc_security_features __read_mostly = \
1920

2021
ssize_t cpu_show_meltdown(struct device *dev, struct device_attribute *attr, char *buf)
2122
{
22-
if (rfi_flush)
23-
return sprintf(buf, "Mitigation: RFI Flush\n");
23+
bool thread_priv;
24+
25+
thread_priv = security_ftr_enabled(SEC_FTR_L1D_THREAD_PRIV);
26+
27+
if (rfi_flush || thread_priv) {
28+
struct seq_buf s;
29+
seq_buf_init(&s, buf, PAGE_SIZE - 1);
30+
31+
seq_buf_printf(&s, "Mitigation: ");
32+
33+
if (rfi_flush)
34+
seq_buf_printf(&s, "RFI Flush");
35+
36+
if (rfi_flush && thread_priv)
37+
seq_buf_printf(&s, ", ");
38+
39+
if (thread_priv)
40+
seq_buf_printf(&s, "L1D private per thread");
41+
42+
seq_buf_printf(&s, "\n");
43+
44+
return s.len;
45+
}
46+
47+
if (!security_ftr_enabled(SEC_FTR_L1D_FLUSH_HV) &&
48+
!security_ftr_enabled(SEC_FTR_L1D_FLUSH_PR))
49+
return sprintf(buf, "Not affected\n");
2450

2551
return sprintf(buf, "Vulnerable\n");
2652
}

0 commit comments

Comments
 (0)