]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
x86/alternative: Use helper functions for patching alternatives
authorJuergen Gross <jgross@suse.com>
Mon, 5 Jan 2026 08:04:51 +0000 (09:04 +0100)
committerBorislav Petkov (AMD) <bp@alien8.de>
Wed, 7 Jan 2026 15:05:11 +0000 (16:05 +0100)
commit544b4e15ed106b0e8cd2d584f576e3fda13d8f5f
tree4b5fda0cc8e3bf02fe0709a92acc2f4b942cd79f
parent9ace4753a5202b02191d54e9fdf7f9e3d02b85eb
x86/alternative: Use helper functions for patching alternatives

Tidy up apply_alternatives() by moving the main patching action of a single
alternative instance into 3 helper functions:

- analyze_patch_site() for selection whether patching should occur or not and
  to handle nested alternatives.

- prep_patch_site() for applying any needed relocations and issuing debug
  prints for the site.

- patch_site() doing the real patching action, including optimization of any
  padding NOPs.

In prep_patch_site() use __apply_relocation() instead of
text_poke_apply_relocation(), as the NOP optimization is now done in
patch_site() for all cases.

Suggested-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://patch.msgid.link/20260105080452.5064-2-jgross@suse.com
arch/x86/kernel/alternative.c