* [mhiramat:kprobes/kretprobe-stackfix-v5 11/12] arch/x86/kernel/unwind_orc.c:560:6: warning: incompatible integer to pointer conversion passing 'unsigned long' to parameter of type 'unsigned long
@ 2021-03-25 23:32 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-03-25 23:32 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 9876 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mhiramat/linux.git kprobes/kretprobe-stackfix-v5
head: 35cc7cf18147efc55032c47d3c9669ed052ae9c0
commit: 2d1e9fb21b51c494aadaffc8b76aae3feceef851 [11/12] x86/unwind: Recover kretprobe trampoline entry
config: x86_64-randconfig-r015-20210325 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 5d6b4aa80d6df62b924a12af030c5ded868ee4f1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/mhiramat/linux.git/commit/?id=2d1e9fb21b51c494aadaffc8b76aae3feceef851
git remote add mhiramat https://git.kernel.org/pub/scm/linux/kernel/git/mhiramat/linux.git
git fetch --no-tags mhiramat kprobes/kretprobe-stackfix-v5
git checkout 2d1e9fb21b51c494aadaffc8b76aae3feceef851
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> arch/x86/kernel/unwind_orc.c:560:6: warning: incompatible integer to pointer conversion passing 'unsigned long' to parameter of type 'unsigned long *' [-Wint-conversion]
state->sp - sizeof(unsigned long));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/unwind.h:106:47: note: passing argument to parameter 'addr_p' here
unsigned long addr, unsigned long *addr_p)
^
arch/x86/kernel/unwind_orc.c:575:6: warning: incompatible integer to pointer conversion passing 'unsigned long' to parameter of type 'unsigned long *' [-Wint-conversion]
state->sp - sizeof(unsigned long));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/unwind.h:106:47: note: passing argument to parameter 'addr_p' here
unsigned long addr, unsigned long *addr_p)
^
2 warnings generated.
vim +560 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 = unwind_recover_ret_addr(state, state->ip,
539 (unsigned long *)ip_p);
540 state->sp = sp;
541 state->regs = NULL;
542 state->prev_regs = NULL;
543 state->signal = false;
544 break;
545
546 case UNWIND_HINT_TYPE_REGS:
547 if (!deref_stack_regs(state, sp, &state->ip, &state->sp)) {
548 orc_warn_current("can't access registers at %pB\n",
549 (void *)orig_ip);
550 goto err;
551 }
552 /*
553 * There is a small chance to interrupt at the entry of
554 * kretprobe_trampoline where the ORC info doesn't exist.
555 * That point is right after the RET to kretprobe_trampoline
556 * which was modified return address. So the @addr_p must
557 * be right before the regs->sp.
558 */
559 state->ip = unwind_recover_kretprobe(state, state->ip,
> 560 state->sp - sizeof(unsigned long));
561 state->regs = (struct pt_regs *)sp;
562 state->prev_regs = NULL;
563 state->full_regs = true;
564 state->signal = true;
565 break;
566
567 case UNWIND_HINT_TYPE_REGS_PARTIAL:
568 if (!deref_stack_iret_regs(state, sp, &state->ip, &state->sp)) {
569 orc_warn_current("can't access iret registers at %pB\n",
570 (void *)orig_ip);
571 goto err;
572 }
573 /* See UNWIND_HINT_TYPE_REGS case comment. */
574 state->ip = unwind_recover_kretprobe(state, state->ip,
575 state->sp - sizeof(unsigned long));
576
577 if (state->full_regs)
578 state->prev_regs = state->regs;
579 state->regs = (void *)sp - IRET_FRAME_OFFSET;
580 state->full_regs = false;
581 state->signal = true;
582 break;
583
584 default:
585 orc_warn("unknown .orc_unwind entry type %d at %pB\n",
586 orc->type, (void *)orig_ip);
587 goto err;
588 }
589
590 /* Find BP: */
591 switch (orc->bp_reg) {
592 case ORC_REG_UNDEFINED:
593 if (get_reg(state, offsetof(struct pt_regs, bp), &tmp))
594 state->bp = tmp;
595 break;
596
597 case ORC_REG_PREV_SP:
598 if (!deref_stack_reg(state, sp + orc->bp_offset, &state->bp))
599 goto err;
600 break;
601
602 case ORC_REG_BP:
603 if (!deref_stack_reg(state, state->bp + orc->bp_offset, &state->bp))
604 goto err;
605 break;
606
607 default:
608 orc_warn("unknown BP base reg %d for ip %pB\n",
609 orc->bp_reg, (void *)orig_ip);
610 goto err;
611 }
612
613 /* Prevent a recursive loop due to bad ORC data: */
614 if (state->stack_info.type == prev_type &&
615 on_stack(&state->stack_info, (void *)state->sp, sizeof(long)) &&
616 state->sp <= prev_sp) {
617 orc_warn_current("stack going in the wrong direction?@%pB\n",
618 (void *)orig_ip);
619 goto err;
620 }
621
622 preempt_enable();
623 return true;
624
625 err:
626 state->error = true;
627
628 the_end:
629 preempt_enable();
630 state->stack_info.type = STACK_TYPE_UNKNOWN;
631 return false;
632 }
633 EXPORT_SYMBOL_GPL(unwind_next_frame);
634
---
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: 35524 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-03-25 23:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-25 23:32 [mhiramat:kprobes/kretprobe-stackfix-v5 11/12] arch/x86/kernel/unwind_orc.c:560:6: warning: incompatible integer to pointer conversion passing 'unsigned long' to parameter of type 'unsigned long kernel test robot
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.