From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [mhiramat:kprobes/kretprobe-stackfix 9/10] arch/x86/kernel/unwind_orc.c:547:18: error: 'struct unwind_state' has no member named 'kr_iter'
Date: Wed, 17 Mar 2021 01:56:14 +0800 [thread overview]
Message-ID: <202103170111.o5fFbLIk-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 8311 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mhiramat/linux.git kprobes/kretprobe-stackfix
head: 6e2b8966c87adc1be0fb4a386fb24ae438f4cb79
commit: 3f16730e94371a16e7c5490095b089cb198440e6 [9/10] x86/unwind/orc,kprobes: Fixup kretprobe trampoline entry
config: x86_64-randconfig-m001-20210316 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/mhiramat/linux.git/commit/?id=3f16730e94371a16e7c5490095b089cb198440e6
git remote add mhiramat https://git.kernel.org/pub/scm/linux/kernel/git/mhiramat/linux.git
git fetch --no-tags mhiramat kprobes/kretprobe-stackfix
git checkout 3f16730e94371a16e7c5490095b089cb198440e6
# save the attached .config to linux build tree
make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
arch/x86/kernel/unwind_orc.c: In function 'unwind_next_frame':
>> arch/x86/kernel/unwind_orc.c:547:18: error: 'struct unwind_state' has no member named 'kr_iter'
547 | &state->kr_iter);
| ^~
vim +547 arch/x86/kernel/unwind_orc.c
417
418 bool unwind_next_frame(struct unwind_state *state)
419 {
420 unsigned long ip_p, sp, tmp, orig_ip = state->ip, prev_sp = state->sp;
421 enum stack_type prev_type = state->stack_info.type;
422 struct orc_entry *orc;
423 bool indirect = false;
424
425 if (unwind_done(state))
426 return false;
427
428 /* Don't let modules unload while we're reading their ORC data. */
429 preempt_disable();
430
431 /* End-of-stack check for user tasks: */
432 if (state->regs && user_mode(state->regs))
433 goto the_end;
434
435 /*
436 * Find the orc_entry associated with the text address.
437 *
438 * For a call frame (as opposed to a signal frame), state->ip points to
439 * the instruction after the call. That instruction's stack layout
440 * could be different from the call instruction's layout, for example
441 * if the call was to a noreturn function. So get the ORC data for the
442 * call instruction itself.
443 */
444 orc = orc_find(state->signal ? state->ip : state->ip - 1);
445 if (!orc) {
446 /*
447 * As a fallback, try to assume this code uses a frame pointer.
448 * This is useful for generated code, like BPF, which ORC
449 * doesn't know about. This is just a guess, so the rest of
450 * the unwind is no longer considered reliable.
451 */
452 orc = &orc_fp_entry;
453 state->error = true;
454 }
455
456 /* End-of-stack check for kernel threads: */
457 if (orc->sp_reg == ORC_REG_UNDEFINED) {
458 if (!orc->end)
459 goto err;
460
461 goto the_end;
462 }
463
464 /* Find the previous frame's stack: */
465 switch (orc->sp_reg) {
466 case ORC_REG_SP:
467 sp = state->sp + orc->sp_offset;
468 break;
469
470 case ORC_REG_BP:
471 sp = state->bp + orc->sp_offset;
472 break;
473
474 case ORC_REG_SP_INDIRECT:
475 sp = state->sp;
476 indirect = true;
477 break;
478
479 case ORC_REG_BP_INDIRECT:
480 sp = state->bp + orc->sp_offset;
481 indirect = true;
482 break;
483
484 case ORC_REG_R10:
485 if (!get_reg(state, offsetof(struct pt_regs, r10), &sp)) {
486 orc_warn_current("missing R10 value at %pB\n",
487 (void *)state->ip);
488 goto err;
489 }
490 break;
491
492 case ORC_REG_R13:
493 if (!get_reg(state, offsetof(struct pt_regs, r13), &sp)) {
494 orc_warn_current("missing R13 value at %pB\n",
495 (void *)state->ip);
496 goto err;
497 }
498 break;
499
500 case ORC_REG_DI:
501 if (!get_reg(state, offsetof(struct pt_regs, di), &sp)) {
502 orc_warn_current("missing RDI value at %pB\n",
503 (void *)state->ip);
504 goto err;
505 }
506 break;
507
508 case ORC_REG_DX:
509 if (!get_reg(state, offsetof(struct pt_regs, dx), &sp)) {
510 orc_warn_current("missing DX value at %pB\n",
511 (void *)state->ip);
512 goto err;
513 }
514 break;
515
516 default:
517 orc_warn("unknown SP base reg %d at %pB\n",
518 orc->sp_reg, (void *)state->ip);
519 goto err;
520 }
521
522 if (indirect) {
523 if (!deref_stack_reg(state, sp, &sp))
524 goto err;
525
526 if (orc->sp_reg == ORC_REG_SP_INDIRECT)
527 sp += orc->sp_offset;
528 }
529
530 /* Find IP, SP and possibly regs: */
531 switch (orc->type) {
532 case UNWIND_HINT_TYPE_CALL:
533 ip_p = sp - sizeof(long);
534
535 if (!deref_stack_reg(state, ip_p, &state->ip))
536 goto err;
537
538 state->ip = ftrace_graph_ret_addr(state->task, &state->graph_idx,
539 state->ip, (void *)ip_p);
540 /*
541 * When the unwinder finds the kretprobe_trampoline instead of
542 * the real return address on stack, find the correct return
543 * address from task->kretprobe_instances list.
544 */
545 if (is_kretprobe_trampoline(state->ip))
546 state->ip = kretprobe_find_ret_addr(state->task,
> 547 &state->kr_iter);
548
549 state->sp = sp;
550 state->regs = NULL;
551 state->prev_regs = NULL;
552 state->signal = false;
553 break;
554
555 case UNWIND_HINT_TYPE_REGS:
556 if (!deref_stack_regs(state, sp, &state->ip, &state->sp)) {
557 orc_warn_current("can't access registers at %pB\n",
558 (void *)orig_ip);
559 goto err;
560 }
561
562 state->regs = (struct pt_regs *)sp;
563 state->prev_regs = NULL;
564 state->full_regs = true;
565 state->signal = true;
566 break;
567
568 case UNWIND_HINT_TYPE_REGS_PARTIAL:
569 if (!deref_stack_iret_regs(state, sp, &state->ip, &state->sp)) {
570 orc_warn_current("can't access iret registers at %pB\n",
571 (void *)orig_ip);
572 goto err;
573 }
574
575 if (state->full_regs)
576 state->prev_regs = state->regs;
577 state->regs = (void *)sp - IRET_FRAME_OFFSET;
578 state->full_regs = false;
579 state->signal = true;
580 break;
581
582 default:
583 orc_warn("unknown .orc_unwind entry type %d at %pB\n",
584 orc->type, (void *)orig_ip);
585 goto err;
586 }
587
588 /* Find BP: */
589 switch (orc->bp_reg) {
590 case ORC_REG_UNDEFINED:
591 if (get_reg(state, offsetof(struct pt_regs, bp), &tmp))
592 state->bp = tmp;
593 break;
594
595 case ORC_REG_PREV_SP:
596 if (!deref_stack_reg(state, sp + orc->bp_offset, &state->bp))
597 goto err;
598 break;
599
600 case ORC_REG_BP:
601 if (!deref_stack_reg(state, state->bp + orc->bp_offset, &state->bp))
602 goto err;
603 break;
604
605 default:
606 orc_warn("unknown BP base reg %d for ip %pB\n",
607 orc->bp_reg, (void *)orig_ip);
608 goto err;
609 }
610
611 /* Prevent a recursive loop due to bad ORC data: */
612 if (state->stack_info.type == prev_type &&
613 on_stack(&state->stack_info, (void *)state->sp, sizeof(long)) &&
614 state->sp <= prev_sp) {
615 orc_warn_current("stack going in the wrong direction?@%pB\n",
616 (void *)orig_ip);
617 goto err;
618 }
619
620 preempt_enable();
621 return true;
622
623 err:
624 state->error = true;
625
626 the_end:
627 preempt_enable();
628 state->stack_info.type = STACK_TYPE_UNKNOWN;
629 return false;
630 }
631 EXPORT_SYMBOL_GPL(unwind_next_frame);
632
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 31814 bytes --]
reply other threads:[~2021-03-16 17:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202103170111.o5fFbLIk-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.