Commit e6aa1362 authored by Josh Poimboeuf's avatar Josh Poimboeuf Committed by Borislav Petkov

x86/speculation: Fix firmware entry SPEC_CTRL handling

The firmware entry code may accidentally clear STIBP or SSBD. Fix that.
Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
parent b2620fac
...@@ -285,18 +285,16 @@ extern u64 spec_ctrl_current(void); ...@@ -285,18 +285,16 @@ extern u64 spec_ctrl_current(void);
*/ */
#define firmware_restrict_branch_speculation_start() \ #define firmware_restrict_branch_speculation_start() \
do { \ do { \
u64 val = x86_spec_ctrl_base | SPEC_CTRL_IBRS; \
\
preempt_disable(); \ preempt_disable(); \
alternative_msr_write(MSR_IA32_SPEC_CTRL, val, \ alternative_msr_write(MSR_IA32_SPEC_CTRL, \
spec_ctrl_current() | SPEC_CTRL_IBRS, \
X86_FEATURE_USE_IBRS_FW); \ X86_FEATURE_USE_IBRS_FW); \
} while (0) } while (0)
#define firmware_restrict_branch_speculation_end() \ #define firmware_restrict_branch_speculation_end() \
do { \ do { \
u64 val = x86_spec_ctrl_base; \ alternative_msr_write(MSR_IA32_SPEC_CTRL, \
\ spec_ctrl_current(), \
alternative_msr_write(MSR_IA32_SPEC_CTRL, val, \
X86_FEATURE_USE_IBRS_FW); \ X86_FEATURE_USE_IBRS_FW); \
preempt_enable(); \ preempt_enable(); \
} while (0) } while (0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment