Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/alternatives: Rename 'apply_relocation()' to 'text_poke_apply_relocation()'

Join the text_poke_*() API namespace.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Juergen Gross <jgross@suse.com>
Cc: "H . Peter Anvin" <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20250411054105.2341982-52-mingo@kernel.org

Ingo Molnar 023f42dd dac0d754

+7 -7
+1 -1
arch/x86/include/asm/text-patching.h
··· 15 15 16 16 extern void text_poke_early(void *addr, const void *opcode, size_t len); 17 17 18 - extern void apply_relocation(u8 *buf, const u8 * const instr, size_t instrlen, u8 *repl, size_t repl_len); 18 + extern void text_poke_apply_relocation(u8 *buf, const u8 * const instr, size_t instrlen, u8 *repl, size_t repl_len); 19 19 20 20 /* 21 21 * Clear and restore the kernel write-protection flag on the local CPU.
+3 -3
arch/x86/kernel/alternative.c
··· 340 340 } 341 341 } 342 342 343 - void apply_relocation(u8 *buf, const u8 * const instr, size_t instrlen, u8 *repl, size_t repl_len) 343 + void text_poke_apply_relocation(u8 *buf, const u8 * const instr, size_t instrlen, u8 *repl, size_t repl_len) 344 344 { 345 345 __apply_relocation(buf, instr, instrlen, repl, repl_len); 346 346 optimize_nops(instr, buf, instrlen); ··· 496 496 for (; insn_buff_sz < a->instrlen; insn_buff_sz++) 497 497 insn_buff[insn_buff_sz] = 0x90; 498 498 499 - apply_relocation(insn_buff, instr, a->instrlen, replacement, a->replacementlen); 499 + text_poke_apply_relocation(insn_buff, instr, a->instrlen, replacement, a->replacementlen); 500 500 501 501 DUMP_BYTES(ALT, instr, a->instrlen, "%px: old_insn: ", instr); 502 502 DUMP_BYTES(ALT, replacement, a->replacementlen, "%px: rpl_insn: ", replacement); ··· 1981 1981 static noinline void __init alt_reloc_selftest(void) 1982 1982 { 1983 1983 /* 1984 - * Tests apply_relocation(). 1984 + * Tests text_poke_apply_relocation(). 1985 1985 * 1986 1986 * This has a relative immediate (CALL) in a place other than the first 1987 1987 * instruction and additionally on x86_64 we get a RIP-relative LEA:
+3 -3
arch/x86/kernel/callthunks.c
··· 185 185 u8 *pad = dest - tsize; 186 186 187 187 memcpy(insn_buff, skl_call_thunk_template, tsize); 188 - apply_relocation(insn_buff, pad, tsize, skl_call_thunk_template, tsize); 188 + text_poke_apply_relocation(insn_buff, pad, tsize, skl_call_thunk_template, tsize); 189 189 190 190 /* Already patched? */ 191 191 if (!bcmp(pad, insn_buff, tsize)) ··· 294 294 pad = (void *)(dest - tmpl_size); 295 295 296 296 memcpy(insn_buff, skl_call_thunk_template, tmpl_size); 297 - apply_relocation(insn_buff, pad, tmpl_size, skl_call_thunk_template, tmpl_size); 297 + text_poke_apply_relocation(insn_buff, pad, tmpl_size, skl_call_thunk_template, tmpl_size); 298 298 299 299 return !bcmp(pad, insn_buff, tmpl_size); 300 300 } ··· 312 312 return 0; 313 313 314 314 memcpy(insn_buff, skl_call_thunk_template, tmpl_size); 315 - apply_relocation(insn_buff, ip, tmpl_size, skl_call_thunk_template, tmpl_size); 315 + text_poke_apply_relocation(insn_buff, ip, tmpl_size, skl_call_thunk_template, tmpl_size); 316 316 317 317 memcpy(*pprog, insn_buff, tmpl_size); 318 318 *pprog += tmpl_size;