@@ -3902,7 +3902,7 @@
nospec_store_bypass_disable
[HW] Disable all mitigations for the Speculative Store Bypass vulnerability
- nospectre_bhb [ARM64] Disable all mitigations for Spectre-BHB (branch
+ nospectre_bhb [ARM,ARM64] Disable all mitigations for Spectre-BHB (branch
history injection) vulnerability. System may allow data leaks
with this option.
@@ -9,6 +9,15 @@
#include <asm/spectre.h>
#include <asm/system_misc.h>
+static int nospectre_bhb __read_mostly;
+
+static int __init nospectre_bhb_setup(char *str)
+{
+ nospectre_bhb = 1;
+ return 0;
+}
+early_param("nospectre_bhb", nospectre_bhb_setup);
+
#ifdef CONFIG_ARM_PSCI
static int __maybe_unused spectre_v2_get_cpu_fw_mitigation_state(void)
{
@@ -226,6 +235,11 @@ static void cpu_v7_spectre_bhb_init(void)
{
unsigned int state, method = 0;
+ if (nospectre_bhb) {
+ pr_info_once("Spectre bhb: hardening is disabled\n");
+ return;
+ }
+
switch (read_cpuid_part()) {
case ARM_CPU_PART_CORTEX_A15:
case ARM_CPU_PART_BRAHMA_B15:
spectre-bhb mitigation is enabled by default on ARM32, which may cause performance regression. To offer an option to turn off the mitigation, here expand an existing cmdline parameter 'nospectre_bhb' to ARM32, which sets up a switch to skip the mitigation code entry and bhb workarounds in mitigation method handler. Signed-off-by: Chen Jiahao <chenjiahao16@huawei.com> --- Documentation/admin-guide/kernel-parameters.txt | 2 +- arch/arm/mm/proc-v7-bugs.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-)