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
This commit is contained in:
Juergen Gross 2026-01-05 09:04:51 +01:00 • committed by Borislav Petkov (AMD)
commit 544b4e15ed