x86/srso: Fix return thunks in generated code
authorJosh Poimboeuf <jpoimboe@kernel.org>
Fri, 28 Jul 2023 22:28:43 +0000 (17:28 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Aug 2023 18:03:51 +0000 (20:03 +0200)
commitc7f2cd04554259c2474c4f9fa134528bc2826b22
tree67ad69cf4afe9f1ceab73d4c405c71d8d16bfa56
parentc9ae63d773ca182c4ef63fbdd22cdf090d9c1cd7
x86/srso: Fix return thunks in generated code

Upstream commit: 238ec850b95a02dcdff3edc86781aa913549282f

Set X86_FEATURE_RETHUNK when enabling the SRSO mitigation so that
generated code (e.g., ftrace, static call, eBPF) generates "jmp
__x86_return_thunk" instead of RET.

  [ bp: Add a comment. ]

Fixes: fb3bd914b3ec ("x86/srso: Add a Speculative RAS Overflow mitigation")
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/alternative.c
arch/x86/kernel/cpu/bugs.c