Skip to content

Commit 0e6c16c

Browse files
suryasaimadhuKAGA-KOKO
authored andcommitted
x86/alternative: Print unadorned pointers
After commit ad67b74 ("printk: hash addresses printed with %p") pointers are being hashed when printed. However, this makes the alternative debug output completely useless. Switch to %px in order to see the unadorned kernel pointers. Signed-off-by: Borislav Petkov <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: David Woodhouse <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: Josh Poimboeuf <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected]
1 parent 20ffa1c commit 0e6c16c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

arch/x86/kernel/alternative.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ recompute_jump(struct alt_instr *a, u8 *orig_insn, u8 *repl_insn, u8 *insnbuf)
298298
tgt_rip = next_rip + o_dspl;
299299
n_dspl = tgt_rip - orig_insn;
300300

301-
DPRINTK("target RIP: %p, new_displ: 0x%x", tgt_rip, n_dspl);
301+
DPRINTK("target RIP: %px, new_displ: 0x%x", tgt_rip, n_dspl);
302302

303303
if (tgt_rip - orig_insn >= 0) {
304304
if (n_dspl - 2 <= 127)
@@ -355,7 +355,7 @@ static void __init_or_module noinline optimize_nops(struct alt_instr *a, u8 *ins
355355
add_nops(instr + (a->instrlen - a->padlen), a->padlen);
356356
local_irq_restore(flags);
357357

358-
DUMP_BYTES(instr, a->instrlen, "%p: [%d:%d) optimized NOPs: ",
358+
DUMP_BYTES(instr, a->instrlen, "%px: [%d:%d) optimized NOPs: ",
359359
instr, a->instrlen - a->padlen, a->padlen);
360360
}
361361

@@ -376,7 +376,7 @@ void __init_or_module noinline apply_alternatives(struct alt_instr *start,
376376
u8 *instr, *replacement;
377377
u8 insnbuf[MAX_PATCH_LEN];
378378

379-
DPRINTK("alt table %p -> %p", start, end);
379+
DPRINTK("alt table %px, -> %px", start, end);
380380
/*
381381
* The scan order should be from start to end. A later scanned
382382
* alternative code can overwrite previously scanned alternative code.
@@ -400,14 +400,14 @@ void __init_or_module noinline apply_alternatives(struct alt_instr *start,
400400
continue;
401401
}
402402

403-
DPRINTK("feat: %d*32+%d, old: (%p, len: %d), repl: (%p, len: %d), pad: %d",
403+
DPRINTK("feat: %d*32+%d, old: (%px len: %d), repl: (%px, len: %d), pad: %d",
404404
a->cpuid >> 5,
405405
a->cpuid & 0x1f,
406406
instr, a->instrlen,
407407
replacement, a->replacementlen, a->padlen);
408408

409-
DUMP_BYTES(instr, a->instrlen, "%p: old_insn: ", instr);
410-
DUMP_BYTES(replacement, a->replacementlen, "%p: rpl_insn: ", replacement);
409+
DUMP_BYTES(instr, a->instrlen, "%px: old_insn: ", instr);
410+
DUMP_BYTES(replacement, a->replacementlen, "%px: rpl_insn: ", replacement);
411411

412412
memcpy(insnbuf, replacement, a->replacementlen);
413413
insnbuf_sz = a->replacementlen;
@@ -433,7 +433,7 @@ void __init_or_module noinline apply_alternatives(struct alt_instr *start,
433433
a->instrlen - a->replacementlen);
434434
insnbuf_sz += a->instrlen - a->replacementlen;
435435
}
436-
DUMP_BYTES(insnbuf, insnbuf_sz, "%p: final_insn: ", instr);
436+
DUMP_BYTES(insnbuf, insnbuf_sz, "%px: final_insn: ", instr);
437437

438438
text_poke_early(instr, insnbuf, insnbuf_sz);
439439
}

0 commit comments

Comments
 (0)