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

Commit 2656568

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 <bp@alien8.de> Signed-off-by: Johannes Wikner <kwikner@ethz.ch> Cc: <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 932c974 commit 2656568

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
@@ -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:
@@ -2632,6 +2640,13 @@ static void __init srso_select_mitigation(void)
26322640
if (!boot_cpu_has(X86_FEATURE_ENTRY_IBPB) && has_microcode) {
26332641
setup_force_cpu_cap(X86_FEATURE_IBPB_ON_VMEXIT);
26342642
srso_mitigation = SRSO_MITIGATION_IBPB_ON_VMEXIT;
2643+
2644+
/*
2645+
* There is no need for RSB filling: entry_ibpb() ensures
2646+
* all predictions, including the RSB, are invalidated,
2647+
* regardless of IBPB implementation.
2648+
*/
2649+
setup_clear_cpu_cap(X86_FEATURE_RSB_VMEXIT);
26352650
}
26362651
} else {
26372652
pr_err("WARNING: kernel not compiled with MITIGATION_SRSO.\n");

0 commit comments

Comments
 (0)