]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.14.110/powerpc-64-disable-the-speculation-barrier-from-the-command-line.patch
Linux 4.9.167
[thirdparty/kernel/stable-queue.git] / releases / 4.14.110 / powerpc-64-disable-the-speculation-barrier-from-the-command-line.patch
1 From foo@baz Fri Mar 29 15:53:50 CET 2019
2 From: Michael Ellerman <mpe@ellerman.id.au>
3 Date: Fri, 29 Mar 2019 22:25:56 +1100
4 Subject: powerpc/64: Disable the speculation barrier from the command line
5 To: stable@vger.kernel.org, gregkh@linuxfoundation.org
6 Cc: linuxppc-dev@ozlabs.org, diana.craciun@nxp.com, msuchanek@suse.de, christophe.leroy@c-s.fr
7 Message-ID: <20190329112620.14489-9-mpe@ellerman.id.au>
8
9 From: Diana Craciun <diana.craciun@nxp.com>
10
11 commit cf175dc315f90185128fb061dc05b6fbb211aa2f upstream.
12
13 The speculation barrier can be disabled from the command line
14 with the parameter: "nospectre_v1".
15
16 Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
17 Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19 ---
20 arch/powerpc/kernel/security.c | 12 +++++++++++-
21 1 file changed, 11 insertions(+), 1 deletion(-)
22
23 --- a/arch/powerpc/kernel/security.c
24 +++ b/arch/powerpc/kernel/security.c
25 @@ -16,6 +16,7 @@
26 unsigned long powerpc_security_features __read_mostly = SEC_FTR_DEFAULT;
27
28 bool barrier_nospec_enabled;
29 +static bool no_nospec;
30
31 static void enable_barrier_nospec(bool enable)
32 {
33 @@ -42,9 +43,18 @@ void setup_barrier_nospec(void)
34 enable = security_ftr_enabled(SEC_FTR_FAVOUR_SECURITY) &&
35 security_ftr_enabled(SEC_FTR_BNDS_CHK_SPEC_BAR);
36
37 - enable_barrier_nospec(enable);
38 + if (!no_nospec)
39 + enable_barrier_nospec(enable);
40 }
41
42 +static int __init handle_nospectre_v1(char *p)
43 +{
44 + no_nospec = true;
45 +
46 + return 0;
47 +}
48 +early_param("nospectre_v1", handle_nospectre_v1);
49 +
50 #ifdef CONFIG_DEBUG_FS
51 static int barrier_nospec_set(void *data, u64 val)
52 {