Skip to content

Commit 54b53dc

Browse files
dkaplan2bp3tk0v
authored andcommitted
x86/bugs: Add attack vector controls for RFDS
Use attack vector controls to determine if RFDS mitigation is required. Signed-off-by: David Kaplan <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Link: https://lore.kernel.org/[email protected]
1 parent de6f092 commit 54b53dc

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

arch/x86/kernel/cpu/bugs.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -748,13 +748,17 @@ static inline bool __init verw_clears_cpu_reg_file(void)
748748

749749
static void __init rfds_select_mitigation(void)
750750
{
751-
if (!boot_cpu_has_bug(X86_BUG_RFDS) || cpu_mitigations_off()) {
751+
if (!boot_cpu_has_bug(X86_BUG_RFDS)) {
752752
rfds_mitigation = RFDS_MITIGATION_OFF;
753753
return;
754754
}
755755

756-
if (rfds_mitigation == RFDS_MITIGATION_AUTO)
757-
rfds_mitigation = RFDS_MITIGATION_VERW;
756+
if (rfds_mitigation == RFDS_MITIGATION_AUTO) {
757+
if (should_mitigate_vuln(X86_BUG_RFDS))
758+
rfds_mitigation = RFDS_MITIGATION_VERW;
759+
else
760+
rfds_mitigation = RFDS_MITIGATION_OFF;
761+
}
758762

759763
if (rfds_mitigation == RFDS_MITIGATION_OFF)
760764
return;
@@ -765,7 +769,7 @@ static void __init rfds_select_mitigation(void)
765769

766770
static void __init rfds_update_mitigation(void)
767771
{
768-
if (!boot_cpu_has_bug(X86_BUG_RFDS) || cpu_mitigations_off())
772+
if (!boot_cpu_has_bug(X86_BUG_RFDS))
769773
return;
770774

771775
if (verw_clear_cpu_buf_mitigation_selected)

0 commit comments

Comments
 (0)