Skip to content

Commit 73c7176

Browse files
jpoimboegregkh
authored andcommitted
x86/alternatives: Remove faulty optimization
commit 4ba89dd6ddeca2a733bdaed7c9a5cbe4e19d9124 upstream. The following commit 095b8303f383 ("x86/alternative: Make custom return thunk unconditional") made '__x86_return_thunk' a placeholder value. All code setting X86_FEATURE_RETHUNK also changes the value of 'x86_return_thunk'. So the optimization at the beginning of apply_returns() is dead code. Also, before the above-mentioned commit, the optimization actually had a bug It bypassed __static_call_fixup(), causing some raw returns to remain unpatched in static call trampolines. Thus the 'Fixes' tag. Fixes: d2408e043e72 ("x86/alternative: Optimize returns patching") Signed-off-by: Josh Poimboeuf <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Acked-by: Borislav Petkov (AMD) <[email protected]> Link: https://lore.kernel.org/r/16d19d2249d4485d8380fb215ffaae81e6b8119e.1693889988.git.jpoimboe@kernel.org Signed-off-by: Pawan Gupta <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 7e00c01 commit 73c7176

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

arch/x86/kernel/alternative.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -796,14 +796,6 @@ void __init_or_module noinline apply_returns(s32 *start, s32 *end)
796796
{
797797
s32 *s;
798798

799-
/*
800-
* Do not patch out the default return thunks if those needed are the
801-
* ones generated by the compiler.
802-
*/
803-
if (cpu_feature_enabled(X86_FEATURE_RETHUNK) &&
804-
(x86_return_thunk == __x86_return_thunk))
805-
return;
806-
807799
for (s = start; s < end; s++) {
808800
void *dest = NULL, *addr = (void *)s + *s;
809801
struct insn insn;

0 commit comments

Comments
 (0)