]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
x86/bugs: Fix the SRSO mitigation on Zen3/4
authorBorislav Petkov (AMD) <bp@alien8.de>
Thu, 28 Mar 2024 12:59:05 +0000 (13:59 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2024 13:32:49 +0000 (15:32 +0200)
commit1a22ce94b44b289a592ad57f313d0fbd1ae681cd
tree1378d5b581e8f825c403dddc441be61367e40653
parenta7b83a44619a3310b12aa5608ea2ac16f73d27e3
x86/bugs: Fix the SRSO mitigation on Zen3/4

commit 4535e1a4174c4111d92c5a9a21e542d232e0fcaa upstream.

The original version of the mitigation would patch in the calls to the
untraining routines directly.  That is, the alternative() in UNTRAIN_RET
will patch in the CALL to srso_alias_untrain_ret() directly.

However, even if commit e7c25c441e9e ("x86/cpu: Cleanup the untrain
mess") meant well in trying to clean up the situation, due to micro-
architectural reasons, the untraining routine srso_alias_untrain_ret()
must be the target of a CALL instruction and not of a JMP instruction as
it is done now.

Reshuffle the alternative macros to accomplish that.

Fixes: e7c25c441e9e ("x86/cpu: Cleanup the untrain mess")
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/include/asm/asm-prototypes.h
arch/x86/include/asm/nospec-branch.h
arch/x86/lib/retpoline.S