]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
x86/alternative: Optimize returns patching
authorBorislav Petkov (AMD) <bp@alien8.de>
Sat, 17 May 2025 00:01:32 +0000 (17:01 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 May 2025 12:08:23 +0000 (14:08 +0200)
commita70424c61d5e6ada80b546d4f585fab9c05993e6
tree886c200ef0312744d496869c34719a879f6e487b
parent858073be8899e16cc469be9c1837d6c3a64887fa
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