Skip to content

Commit 58c3862

Browse files
jpoimboeIngo Molnar
authored andcommitted
x86/unwind: Show function name+offset in ORC error messages
Improve the warning messages to show the relevant function name+offset. This makes it much easier to diagnose problems with the ORC metadata. Before: WARNING: can't dereference iret registers at ffff8801c5f17fe0 for ip ffffffff95f0d94b After: WARNING: can't dereference iret registers at ffff880178f5ffe0 for ip int3+0x5b/0x60 Reported-by: Andrei Vagin <avagin@virtuozzo.com> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Fixes: ee9f8fc ("x86/unwind: Add the ORC unwinder") Link: http://lkml.kernel.org/r/6bada6b9eac86017e16bd79e1e77877935cb50bb.1508516398.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 98990a3 commit 58c3862

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

arch/x86/kernel/unwind_orc.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ static struct orc_entry *orc_find(unsigned long ip)
8686
idx = (ip - LOOKUP_START_IP) / LOOKUP_BLOCK_SIZE;
8787

8888
if (unlikely((idx >= lookup_num_blocks-1))) {
89-
orc_warn("WARNING: bad lookup idx: idx=%u num=%u ip=%lx\n",
90-
idx, lookup_num_blocks, ip);
89+
orc_warn("WARNING: bad lookup idx: idx=%u num=%u ip=%pB\n",
90+
idx, lookup_num_blocks, (void *)ip);
9191
return NULL;
9292
}
9393

@@ -96,8 +96,8 @@ static struct orc_entry *orc_find(unsigned long ip)
9696

9797
if (unlikely((__start_orc_unwind + start >= __stop_orc_unwind) ||
9898
(__start_orc_unwind + stop > __stop_orc_unwind))) {
99-
orc_warn("WARNING: bad lookup value: idx=%u num=%u start=%u stop=%u ip=%lx\n",
100-
idx, lookup_num_blocks, start, stop, ip);
99+
orc_warn("WARNING: bad lookup value: idx=%u num=%u start=%u stop=%u ip=%pB\n",
100+
idx, lookup_num_blocks, start, stop, (void *)ip);
101101
return NULL;
102102
}
103103

@@ -373,7 +373,7 @@ bool unwind_next_frame(struct unwind_state *state)
373373

374374
case ORC_REG_R10:
375375
if (!state->regs || !state->full_regs) {
376-
orc_warn("missing regs for base reg R10 at ip %p\n",
376+
orc_warn("missing regs for base reg R10 at ip %pB\n",
377377
(void *)state->ip);
378378
goto done;
379379
}
@@ -382,7 +382,7 @@ bool unwind_next_frame(struct unwind_state *state)
382382

383383
case ORC_REG_R13:
384384
if (!state->regs || !state->full_regs) {
385-
orc_warn("missing regs for base reg R13 at ip %p\n",
385+
orc_warn("missing regs for base reg R13 at ip %pB\n",
386386
(void *)state->ip);
387387
goto done;
388388
}
@@ -391,7 +391,7 @@ bool unwind_next_frame(struct unwind_state *state)
391391

392392
case ORC_REG_DI:
393393
if (!state->regs || !state->full_regs) {
394-
orc_warn("missing regs for base reg DI at ip %p\n",
394+
orc_warn("missing regs for base reg DI at ip %pB\n",
395395
(void *)state->ip);
396396
goto done;
397397
}
@@ -400,15 +400,15 @@ bool unwind_next_frame(struct unwind_state *state)
400400

401401
case ORC_REG_DX:
402402
if (!state->regs || !state->full_regs) {
403-
orc_warn("missing regs for base reg DX at ip %p\n",
403+
orc_warn("missing regs for base reg DX at ip %pB\n",
404404
(void *)state->ip);
405405
goto done;
406406
}
407407
sp = state->regs->dx;
408408
break;
409409

410410
default:
411-
orc_warn("unknown SP base reg %d for ip %p\n",
411+
orc_warn("unknown SP base reg %d for ip %pB\n",
412412
orc->sp_reg, (void *)state->ip);
413413
goto done;
414414
}
@@ -436,7 +436,7 @@ bool unwind_next_frame(struct unwind_state *state)
436436

437437
case ORC_TYPE_REGS:
438438
if (!deref_stack_regs(state, sp, &state->ip, &state->sp, true)) {
439-
orc_warn("can't dereference registers at %p for ip %p\n",
439+
orc_warn("can't dereference registers at %p for ip %pB\n",
440440
(void *)sp, (void *)orig_ip);
441441
goto done;
442442
}
@@ -448,7 +448,7 @@ bool unwind_next_frame(struct unwind_state *state)
448448

449449
case ORC_TYPE_REGS_IRET:
450450
if (!deref_stack_regs(state, sp, &state->ip, &state->sp, false)) {
451-
orc_warn("can't dereference iret registers at %p for ip %p\n",
451+
orc_warn("can't dereference iret registers at %p for ip %pB\n",
452452
(void *)sp, (void *)orig_ip);
453453
goto done;
454454
}
@@ -465,7 +465,8 @@ bool unwind_next_frame(struct unwind_state *state)
465465
break;
466466

467467
default:
468-
orc_warn("unknown .orc_unwind entry type %d\n", orc->type);
468+
orc_warn("unknown .orc_unwind entry type %d for ip %pB\n",
469+
orc->type, (void *)orig_ip);
469470
break;
470471
}
471472

@@ -487,7 +488,7 @@ bool unwind_next_frame(struct unwind_state *state)
487488
break;
488489

489490
default:
490-
orc_warn("unknown BP base reg %d for ip %p\n",
491+
orc_warn("unknown BP base reg %d for ip %pB\n",
491492
orc->bp_reg, (void *)orig_ip);
492493
goto done;
493494
}
@@ -496,7 +497,7 @@ bool unwind_next_frame(struct unwind_state *state)
496497
if (state->stack_info.type == prev_type &&
497498
on_stack(&state->stack_info, (void *)state->sp, sizeof(long)) &&
498499
state->sp <= prev_sp) {
499-
orc_warn("stack going in the wrong direction? ip=%p\n",
500+
orc_warn("stack going in the wrong direction? ip=%pB\n",
500501
(void *)orig_ip);
501502
goto done;
502503
}

0 commit comments

Comments
 (0)