mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
x86/bugs: Skip RSB fill at VMEXIT
commit 0fad2878642ec46225af2054564932745ac5c765 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>
This commit is contained in:
parent
61211f2da0
commit
c42a343158
1 changed files with 15 additions and 0 deletions
|
@ -1115,6 +1115,14 @@ do_cmd_auto:
|
||||||
setup_force_cpu_cap(X86_FEATURE_ENTRY_IBPB);
|
setup_force_cpu_cap(X86_FEATURE_ENTRY_IBPB);
|
||||||
setup_force_cpu_cap(X86_FEATURE_IBPB_ON_VMEXIT);
|
setup_force_cpu_cap(X86_FEATURE_IBPB_ON_VMEXIT);
|
||||||
mitigate_smt = true;
|
mitigate_smt = true;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* There is no need for RSB filling: entry_ibpb() ensures
|
||||||
|
* all predictions, including the RSB, are invalidated,
|
||||||
|
* regardless of IBPB implementation.
|
||||||
|
*/
|
||||||
|
setup_clear_cpu_cap(X86_FEATURE_RSB_VMEXIT);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RETBLEED_MITIGATION_STUFF:
|
case RETBLEED_MITIGATION_STUFF:
|
||||||
|
@ -2622,6 +2630,13 @@ static void __init srso_select_mitigation(void)
|
||||||
if (!boot_cpu_has(X86_FEATURE_ENTRY_IBPB) && has_microcode) {
|
if (!boot_cpu_has(X86_FEATURE_ENTRY_IBPB) && has_microcode) {
|
||||||
setup_force_cpu_cap(X86_FEATURE_IBPB_ON_VMEXIT);
|
setup_force_cpu_cap(X86_FEATURE_IBPB_ON_VMEXIT);
|
||||||
srso_mitigation = SRSO_MITIGATION_IBPB_ON_VMEXIT;
|
srso_mitigation = SRSO_MITIGATION_IBPB_ON_VMEXIT;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* There is no need for RSB filling: entry_ibpb() ensures
|
||||||
|
* all predictions, including the RSB, are invalidated,
|
||||||
|
* regardless of IBPB implementation.
|
||||||
|
*/
|
||||||
|
setup_clear_cpu_cap(X86_FEATURE_RSB_VMEXIT);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pr_err("WARNING: kernel not compiled with CPU_SRSO.\n");
|
pr_err("WARNING: kernel not compiled with CPU_SRSO.\n");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue