The firmware entry code may accidentally clear STIBP or SSBD. Fix that.
Unified · Split
| @@ -285,18 +285,16 @@ extern u64 spec_ctrl_current(void); · 284 unmodified lines | ||
| 285 | 285 | */ |
| 286 | 286 | #define firmware_restrict_branch_speculation_start() \ |
| 287 | 287 | do { \ |
| 288 | − u64 val = x86_spec_ctrl_base | SPEC_CTRL_IBRS; \ | |
| 289 | − \ | |
| 290 | 288 | preempt_disable(); \ |
| 291 | − alternative_msr_write(MSR_IA32_SPEC_CTRL, val, \ | |
| 289 | + alternative_msr_write(MSR_IA32_SPEC_CTRL, \ | |
| 290 | + spec_ctrl_current() | SPEC_CTRL_IBRS, \ | |
| 292 | 291 | X86_FEATURE_USE_IBRS_FW); \ |
| 293 | 292 | } while (0) |
| 294 | 293 | |
| 295 | 294 | #define firmware_restrict_branch_speculation_end() \ |
| 296 | 295 | do { \ |
| 297 | − u64 val = x86_spec_ctrl_base; \ | |
| 298 | − \ | |
| 299 | − alternative_msr_write(MSR_IA32_SPEC_CTRL, val, \ | |
| 296 | + alternative_msr_write(MSR_IA32_SPEC_CTRL, \ | |
| 297 | + spec_ctrl_current(), \ | |
| 300 | 298 | X86_FEATURE_USE_IBRS_FW); \ |
| 301 | 299 | preempt_enable(); \ |
| 302 | 300 | } while (0) |