]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.9.107/powerpc-64s-enhance-the-information-in-cpu_show_meltdown.patch
Fix up backported ptrace patch
[thirdparty/kernel/stable-queue.git] / releases / 4.9.107 / powerpc-64s-enhance-the-information-in-cpu_show_meltdown.patch
CommitLineData
37d6ae9e
GKH
1From foo@baz Sat Jun 2 15:29:05 CEST 2018
2From: Michael Ellerman <mpe@ellerman.id.au>
3Date: Sat, 2 Jun 2018 21:08:59 +1000
4Subject: powerpc/64s: Enhance the information in cpu_show_meltdown()
5To: gregkh@linuxfoundation.org
6Cc: stable@vger.kernel.org, linuxppc-dev@ozlabs.org
7Message-ID: <20180602110908.29773-15-mpe@ellerman.id.au>
8
9From: Michael Ellerman <mpe@ellerman.id.au>
10
11commit ff348355e9c72493947be337bb4fae4fc1a41eba upstream.
12
13Now that we have the security feature flags we can make the
14information displayed in the "meltdown" file more informative.
15
16Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
17Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18---
19 arch/powerpc/kernel/security.c | 30 ++++++++++++++++++++++++++++--
20 1 file changed, 28 insertions(+), 2 deletions(-)
21
22--- a/arch/powerpc/kernel/security.c
23+++ b/arch/powerpc/kernel/security.c
24@@ -6,6 +6,7 @@
25
26 #include <linux/kernel.h>
27 #include <linux/device.h>
28+#include <linux/seq_buf.h>
29
30 #include <asm/security_features.h>
31
32@@ -19,8 +20,33 @@ unsigned long powerpc_security_features
33
34 ssize_t cpu_show_meltdown(struct device *dev, struct device_attribute *attr, char *buf)
35 {
36- if (rfi_flush)
37- return sprintf(buf, "Mitigation: RFI Flush\n");
38+ bool thread_priv;
39+
40+ thread_priv = security_ftr_enabled(SEC_FTR_L1D_THREAD_PRIV);
41+
42+ if (rfi_flush || thread_priv) {
43+ struct seq_buf s;
44+ seq_buf_init(&s, buf, PAGE_SIZE - 1);
45+
46+ seq_buf_printf(&s, "Mitigation: ");
47+
48+ if (rfi_flush)
49+ seq_buf_printf(&s, "RFI Flush");
50+
51+ if (rfi_flush && thread_priv)
52+ seq_buf_printf(&s, ", ");
53+
54+ if (thread_priv)
55+ seq_buf_printf(&s, "L1D private per thread");
56+
57+ seq_buf_printf(&s, "\n");
58+
59+ return s.len;
60+ }
61+
62+ if (!security_ftr_enabled(SEC_FTR_L1D_FLUSH_HV) &&
63+ !security_ftr_enabled(SEC_FTR_L1D_FLUSH_PR))
64+ return sprintf(buf, "Not affected\n");
65
66 return sprintf(buf, "Vulnerable\n");
67 }