]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
7e7c16b6afbe9eb26fc0ee2e4d14c5c29bed486b
[thirdparty/kernel/stable-queue.git] /
1 From stable+bounces-151853-greg=kroah.com@vger.kernel.org Sat Jun 7 17:33:21 2025
2 From: Pu Lehui <pulehui@huaweicloud.com>
3 Date: Sat, 7 Jun 2025 15:35:32 +0000
4 Subject: arm64: spectre: increase parameters that can be used to turn off bhb mitigation individually
5 To: stable@vger.kernel.org
6 Cc: james.morse@arm.com, catalin.marinas@arm.com, daniel@iogearbox.net, ast@kernel.org, andrii@kernel.org, xukuohai@huawei.com, pulehui@huawei.com
7 Message-ID: <20250607153535.3613861-7-pulehui@huaweicloud.com>
8
9 From: Liu Song <liusong@linux.alibaba.com>
10
11 [ Upstream commit 877ace9eab7de032f954533afd5d1ecd0cf62eaf ]
12
13 In our environment, it was found that the mitigation BHB has a great
14 impact on the benchmark performance. For example, in the lmbench test,
15 the "process fork && exit" test performance drops by 20%.
16 So it is necessary to have the ability to turn off the mitigation
17 individually through cmdline, thus avoiding having to compile the
18 kernel by adjusting the config.
19
20 Signed-off-by: Liu Song <liusong@linux.alibaba.com>
21 Acked-by: Catalin Marinas <catalin.marinas@arm.com>
22 Link: https://lore.kernel.org/r/1661514050-22263-1-git-send-email-liusong@linux.alibaba.com
23 Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
24 Signed-off-by: Pu Lehui <pulehui@huawei.com>
25 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26 ---
27 Documentation/admin-guide/kernel-parameters.txt | 5 +++++
28 arch/arm64/kernel/proton-pack.c | 10 +++++++++-
29 2 files changed, 14 insertions(+), 1 deletion(-)
30
31 --- a/Documentation/admin-guide/kernel-parameters.txt
32 +++ b/Documentation/admin-guide/kernel-parameters.txt
33 @@ -3105,6 +3105,7 @@
34 spectre_bhi=off [X86]
35 spectre_v2_user=off [X86]
36 ssbd=force-off [ARM64]
37 + nospectre_bhb [ARM64]
38 tsx_async_abort=off [X86]
39
40 Exceptions:
41 @@ -3526,6 +3527,10 @@
42 vulnerability. System may allow data leaks with this
43 option.
44
45 + nospectre_bhb [ARM64] Disable all mitigations for Spectre-BHB (branch
46 + history injection) vulnerability. System may allow data leaks
47 + with this option.
48 +
49 nospec_store_bypass_disable
50 [HW] Disable all mitigations for the Speculative Store Bypass vulnerability
51
52 --- a/arch/arm64/kernel/proton-pack.c
53 +++ b/arch/arm64/kernel/proton-pack.c
54 @@ -1023,6 +1023,14 @@ static void this_cpu_set_vectors(enum ar
55 isb();
56 }
57
58 +static bool __read_mostly __nospectre_bhb;
59 +static int __init parse_spectre_bhb_param(char *str)
60 +{
61 + __nospectre_bhb = true;
62 + return 0;
63 +}
64 +early_param("nospectre_bhb", parse_spectre_bhb_param);
65 +
66 void spectre_bhb_enable_mitigation(const struct arm64_cpu_capabilities *entry)
67 {
68 bp_hardening_cb_t cpu_cb;
69 @@ -1036,7 +1044,7 @@ void spectre_bhb_enable_mitigation(const
70 /* No point mitigating Spectre-BHB alone. */
71 } else if (!IS_ENABLED(CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY)) {
72 pr_info_once("spectre-bhb mitigation disabled by compile time option\n");
73 - } else if (cpu_mitigations_off()) {
74 + } else if (cpu_mitigations_off() || __nospectre_bhb) {
75 pr_info_once("spectre-bhb mitigation disabled by command line option\n");
76 } else if (supports_ecbhb(SCOPE_LOCAL_CPU)) {
77 state = SPECTRE_MITIGATED;