]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
x86/alternative: Optimize returns patching
authorBorislav Petkov (AMD) <bp@alien8.de>
Wed, 18 Jun 2025 00:45:53 +0000 (17:45 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Jul 2025 16:27:55 +0000 (18:27 +0200)
commitad40aa1f3f10cd433f6442e438dbe11449e71aef
tree8db85bb5992b6f4631f46181d70a7c789e87296a
parentae00968afde358ea046eb1a7c7342d8db3b875bd
x86/alternative: Optimize returns patching

commit d2408e043e7296017420aa5929b3bba4d5e61013 upstream.

Instead of decoding each instruction in the return sites range only to
realize that that return site is a jump to the default return thunk
which is needed - X86_FEATURE_RETHUNK is enabled - lift that check
before the loop and get rid of that loop overhead.

Add comments about what gets patched, while at it.

Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20230512120952.7924-1-bp@alien8.de
Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/alternative.c