Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit 0fad287

Browse files
skttbp3tk0v
authored andcommitted
x86/bugs: Skip RSB fill at VMEXIT
entry_ibpb() is designed to follow Intel's IBPB specification regardless of CPU. This includes invalidating RSB entries. Hence, if IBPB on VMEXIT has been selected, entry_ibpb() as part of the RET untraining in the VMEXIT path will take care of all BTB and RSB clearing so there's no need to explicitly fill the RSB anymore. [ bp: Massage commit message. ] Suggested-by: Borislav Petkov <bp@alien8.de> Signed-off-by: Johannes Wikner <kwikner@ethz.ch> Cc: <stable@kernel.org>
1 parent 50e4b3b commit 0fad287

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

arch/x86/kernel/cpu/bugs.c

+15
Original file line numberDiff line numberDiff line change
@@ -1117,6 +1117,14 @@ static void __init retbleed_select_mitigation(void)
11171117
setup_force_cpu_cap(X86_FEATURE_ENTRY_IBPB);
11181118
setup_force_cpu_cap(X86_FEATURE_IBPB_ON_VMEXIT);
11191119
mitigate_smt = true;
1120+
1121+
/*
1122+
* There is no need for RSB filling: entry_ibpb() ensures
1123+
* all predictions, including the RSB, are invalidated,
1124+
* regardless of IBPB implementation.
1125+
*/
1126+
setup_clear_cpu_cap(X86_FEATURE_RSB_VMEXIT);
1127+
11201128
break;
11211129

11221130
case RETBLEED_MITIGATION_STUFF:
@@ -2638,6 +2646,13 @@ static void __init srso_select_mitigation(void)
26382646
if (!boot_cpu_has(X86_FEATURE_ENTRY_IBPB) && has_microcode) {
26392647
setup_force_cpu_cap(X86_FEATURE_IBPB_ON_VMEXIT);
26402648
srso_mitigation = SRSO_MITIGATION_IBPB_ON_VMEXIT;
2649+
2650+
/*
2651+
* There is no need for RSB filling: entry_ibpb() ensures
2652+
* all predictions, including the RSB, are invalidated,
2653+
* regardless of IBPB implementation.
2654+
*/
2655+
setup_clear_cpu_cap(X86_FEATURE_RSB_VMEXIT);
26412656
}
26422657
} else {
26432658
pr_err("WARNING: kernel not compiled with MITIGATION_SRSO.\n");

0 commit comments

Comments
 (0)