Re: [RFC][PATCH 05/17] x86/cpu: Cleanup the untrain mess
From: Borislav Petkov
Date: Sat Aug 12 2023 - 14:30:33 EST
On Wed, Aug 09, 2023 at 03:26:35PM +0200, Peter Zijlstra wrote:
> I think simply setting UNRET for SRSO at this point will be sufficient.
> That ensures the entry_untrain_ret thing gets called, and the
> alternative there DTRT.
>
> The feature isn't used anywhere else afaict.
>
> Then later, after the fancy alternatives happen, this can be cleaned up
> again.
Yes, this fixes it for >= Zen3:
---
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 4b0a770fbacb..611d048f6415 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -2448,6 +2448,7 @@ static void __init srso_select_mitigation(void)
* like ftrace, static_call, etc.
*/
setup_force_cpu_cap(X86_FEATURE_RETHUNK);
+ setup_force_cpu_cap(X86_FEATURE_UNRET);
if (boot_cpu_data.x86 == 0x19) {
setup_force_cpu_cap(X86_FEATURE_SRSO_ALIAS);
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette