Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
- arch/x86/include/asm/nospec-branch.h | 4 +++
- arch/x86/kernel/cpu/bugs.c | 50 +++++++++++++++++++++++++---
+ arch/x86/include/asm/nospec-branch.h | 4 ++
+ arch/x86/kernel/cpu/bugs.c | 50 +++++++++++++++++++++++++++++++----
2 files changed, 49 insertions(+), 5 deletions(-)
-diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h
-index 818a5913f21950..40842aabd21783 100644
--- a/arch/x86/include/asm/nospec-branch.h
+++ b/arch/x86/include/asm/nospec-branch.h
-@@ -280,6 +280,10 @@ extern void srso_alias_untrain_ret(void);
- extern void entry_untrain_ret(void);
- extern void entry_ibpb(void);
+@@ -293,6 +293,10 @@ void srso_safe_ret(void);
+ void srso_alias_safe_ret(void);
+ void handle_interrupted_saferet(struct pt_regs *regs);
+#ifdef CONFIG_BPF_JIT
+extern void bpf_arch_ibpb(void);
#ifdef CONFIG_X86_64
extern void clear_bhb_loop(void);
#endif
-diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
-index a0b362ac50a1b3..662d13612ef4b2 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -16,6 +16,7 @@
#include <asm/spec-ctrl.h>
#include <asm/cmdline.h>
-@@ -1298,8 +1299,21 @@ static inline const char *spectre_v2_module_string(void)
+@@ -1298,8 +1299,21 @@ static inline const char *spectre_v2_mod
{
return spectre_v2_bad_module ? " - vulnerable module loaded" : "";
}
#endif
#define SPECTRE_V2_LFENCE_MSG "WARNING: LFENCE mitigation is not recommended for this CPU, data leaks possible!\n"
-@@ -1780,8 +1794,7 @@ static void __init bhi_select_mitigation(void)
+@@ -1780,8 +1794,7 @@ static void __init bhi_select_mitigation
return;
/* Retpoline mitigates against BHI unless the CPU has RRSBA behavior */
spec_ctrl_disable_kernel_rrsba();
if (rrsba_disabled)
return;
-@@ -1803,6 +1816,27 @@ static void __init bhi_select_mitigation(void)
+@@ -1803,6 +1816,27 @@ static void __init bhi_select_mitigation
pr_info("Spectre BHI mitigation: SW BHB clearing on syscall\n");
}
static void __init spectre_v2_select_mitigation(void)
{
enum spectre_v2_mitigation_cmd cmd = spectre_v2_parse_cmdline();
-@@ -1985,6 +2019,14 @@ static void __init spectre_v2_select_mitigation(void)
+@@ -1985,6 +2019,14 @@ static void __init spectre_v2_select_mit
pr_info("Enabling Restricted Speculation for firmware calls\n");
}
/* Set up IBPB and STIBP depending on the general spectre V2 command */
spectre_v2_cmd = cmd;
}
-@@ -3157,9 +3199,7 @@ static const char *spectre_bhi_state(void)
+@@ -3157,9 +3199,7 @@ static const char *spectre_bhi_state(voi
return "; BHI: BHI_DIS_S";
else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_LOOP))
return "; BHI: SW loop, KVM: SW loop";
return "; BHI: Retpoline";
else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT))
return "; BHI: Vulnerable, KVM: SW loop";
---
-2.53.0
-