Skip to content

Commit c42a343

Browse files
skttgregkh
authored andcommitted
x86/bugs: Skip RSB fill at VMEXIT
commit 0fad287 upstream. 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 <[email protected]> Signed-off-by: Johannes Wikner <[email protected]> Cc: <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 61211f2 commit c42a343

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

arch/x86/kernel/cpu/bugs.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,6 +1115,14 @@ static void __init retbleed_select_mitigation(void)
11151115
setup_force_cpu_cap(X86_FEATURE_ENTRY_IBPB);
11161116
setup_force_cpu_cap(X86_FEATURE_IBPB_ON_VMEXIT);
11171117
mitigate_smt = true;
1118+
1119+
/*
1120+
* There is no need for RSB filling: entry_ibpb() ensures
1121+
* all predictions, including the RSB, are invalidated,
1122+
* regardless of IBPB implementation.
1123+
*/
1124+
setup_clear_cpu_cap(X86_FEATURE_RSB_VMEXIT);
1125+
11181126
break;
11191127

11201128
case RETBLEED_MITIGATION_STUFF:
@@ -2622,6 +2630,13 @@ static void __init srso_select_mitigation(void)
26222630
if (!boot_cpu_has(X86_FEATURE_ENTRY_IBPB) && has_microcode) {
26232631
setup_force_cpu_cap(X86_FEATURE_IBPB_ON_VMEXIT);
26242632
srso_mitigation = SRSO_MITIGATION_IBPB_ON_VMEXIT;
2633+
2634+
/*
2635+
* There is no need for RSB filling: entry_ibpb() ensures
2636+
* all predictions, including the RSB, are invalidated,
2637+
* regardless of IBPB implementation.
2638+
*/
2639+
setup_clear_cpu_cap(X86_FEATURE_RSB_VMEXIT);
26252640
}
26262641
} else {
26272642
pr_err("WARNING: kernel not compiled with CPU_SRSO.\n");

0 commit comments

Comments
 (0)