]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
x86/alternative: Optimize returns patching
authorBorislav Petkov (AMD) <bp@alien8.de>
Fri, 12 May 2023 12:05:11 +0000 (14:05 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 18 May 2025 06:21:26 +0000 (08:21 +0200)
commit7e00c01ff80fd32f3cdfbebc29ddd6af1c404282
tree64c455a24e085cdc099adeb0785d69fb1993beaa
parentc2bece04baf819b9614a35852e4573ee402e059d
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