Skip to content

Commit d4b5a5c

Browse files
author
Peter Zijlstra
committed
x86/alternative: Add debug prints to apply_retpolines()
Make sure we can see the text changes when booting with 'debug-alternative'. Example output: [ ] SMP alternatives: retpoline at: __traceiter_initcall_level+0x1f/0x30 (ffffffff8100066f) len: 5 to: __x86_indirect_thunk_rax+0x0/0x20 [ ] SMP alternatives: ffffffff82603e58: [2:5) optimized NOPs: ff d0 0f 1f 00 [ ] SMP alternatives: ffffffff8100066f: orig: e8 cc 30 00 01 [ ] SMP alternatives: ffffffff8100066f: repl: ff d0 0f 1f 00 Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Borislav Petkov <[email protected]> Acked-by: Josh Poimboeuf <[email protected]> Tested-by: Alexei Starovoitov <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent bbe2df3 commit d4b5a5c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

arch/x86/kernel/alternative.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,15 @@ void __init_or_module noinline apply_retpolines(s32 *start, s32 *end)
492492
continue;
493493
}
494494

495+
DPRINTK("retpoline at: %pS (%px) len: %d to: %pS",
496+
addr, addr, insn.length,
497+
addr + insn.length + insn.immediate.value);
498+
495499
len = patch_retpoline(addr, &insn, bytes);
496500
if (len == insn.length) {
497501
optimize_nops(bytes, len);
502+
DUMP_BYTES(((u8*)addr), len, "%px: orig: ", addr);
503+
DUMP_BYTES(((u8*)bytes), len, "%px: repl: ", addr);
498504
text_poke_early(addr, bytes, len);
499505
}
500506
}

0 commit comments

Comments
 (0)