tree: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git pci/hotplug head: bb5d7215a17f1ae821f48122fb7deb5abbe5b5d1 commit: bb5d7215a17f1ae821f48122fb7deb5abbe5b5d1 [50/50] PCI/AER: Covertly inject errors with ftrace hooks config: i386-randconfig-x073-201840 (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: git checkout bb5d7215a17f1ae821f48122fb7deb5abbe5b5d1 # save the attached .config to linux build tree make ARCH=i386 All errors (new ones prefixed by >>): >> drivers/pci/pcie/aer_inject.c:533:20: error: field 'ops' has incomplete type struct ftrace_ops ops; ^~~ drivers/pci/pcie/aer_inject.c: In function 'aer_inject_resolve_hook_address': >> drivers/pci/pcie/aer_inject.c:564:55: error: 'MCOUNT_INSN_SIZE' undeclared (first use in this function); did you mean 'KCOV_CMP_SIZE'? *((unsigned long*) hook->original) = hook->address + MCOUNT_INSN_SIZE; ^~~~~~~~~~~~~~~~ KCOV_CMP_SIZE drivers/pci/pcie/aer_inject.c:564:55: note: each undeclared identifier is reported only once for each function it appears in drivers/pci/pcie/aer_inject.c: In function 'aer_inject_ftrace_thunk': >> drivers/pci/pcie/aer_inject.c:572:29: error: dereferencing pointer to incomplete type 'struct ftrace_ops' struct aer_hook *hook = ops->private; ^~ drivers/pci/pcie/aer_inject.c: In function 'aer_inject_install_hook': >> drivers/pci/pcie/aer_inject.c:586:20: error: 'FTRACE_OPS_FL_SAVE_REGS' undeclared (first use in this function); did you mean 'PTRACE_SETREGS'? hook->ops.flags = FTRACE_OPS_FL_SAVE_REGS | ^~~~~~~~~~~~~~~~~~~~~~~ PTRACE_SETREGS >> drivers/pci/pcie/aer_inject.c:587:6: error: 'FTRACE_OPS_FL_RECURSION_SAFE' undeclared (first use in this function); did you mean 'FTRACE_OPS_FL_SAVE_REGS'? FTRACE_OPS_FL_RECURSION_SAFE | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ FTRACE_OPS_FL_SAVE_REGS >> drivers/pci/pcie/aer_inject.c:588:6: error: 'FTRACE_OPS_FL_IPMODIFY' undeclared (first use in this function); did you mean 'FTRACE_OPS_FL_SAVE_REGS'? FTRACE_OPS_FL_IPMODIFY; ^~~~~~~~~~~~~~~~~~~~~~ FTRACE_OPS_FL_SAVE_REGS vim +/ops +533 drivers/pci/pcie/aer_inject.c 525 526 static asmlinkage int (*read_config_dword)(struct pci_bus *bus, 527 unsigned int devfn, 528 int where, u32 *val); 529 static asmlinkage int (*write_config_dword)(struct pci_bus *bus, 530 unsigned int devfn, 531 int where, u32 val); 532 struct aer_hook { > 533 struct ftrace_ops ops; 534 const char *name; 535 void *function; 536 void *original; 537 unsigned long address; 538 }; 539 540 static int asmlinkage ainj_read_config_dword(struct pci_bus *bus, 541 unsigned int devfn, int where, u32 *val) 542 { 543 if (!aer_inj_read_config(bus, devfn, where, sizeof(u32), (u32 *)val)) 544 return 0; 545 return read_config_dword(bus, devfn, where, val); 546 } 547 548 static int asmlinkage ainj_write_config_dword(struct pci_bus *bus, 549 unsigned int devfn, int where, u32 val) 550 { 551 if (!aer_inj_write_config(bus, devfn, where, sizeof(u32), val)) 552 return 0; 553 return write_config_dword(bus, devfn, where, val); 554 } 555 556 static int aer_inject_resolve_hook_address(struct aer_hook *hook) 557 { 558 hook->address = kallsyms_lookup_name(hook->name); 559 560 if (!hook->address) { 561 pr_warn("unresolved symbol: %s\n", hook->name); 562 return -ENOENT; 563 } > 564 *((unsigned long*) hook->original) = hook->address + MCOUNT_INSN_SIZE; 565 566 return 0; 567 } 568 569 static void notrace aer_inject_ftrace_thunk(unsigned long ip, unsigned long parent_ip, 570 struct ftrace_ops *ops, struct pt_regs *regs) 571 { > 572 struct aer_hook *hook = ops->private; 573 instruction_pointer_set(regs, (unsigned long)hook->function); 574 } 575 576 static int aer_inject_install_hook(struct aer_hook *hook) 577 { 578 int err; 579 580 err = aer_inject_resolve_hook_address(hook); 581 if (err) 582 return err; 583 584 hook->ops.private = hook; 585 hook->ops.func = aer_inject_ftrace_thunk; > 586 hook->ops.flags = FTRACE_OPS_FL_SAVE_REGS | > 587 FTRACE_OPS_FL_RECURSION_SAFE | > 588 FTRACE_OPS_FL_IPMODIFY; 589 err = ftrace_set_filter_ip(&hook->ops, hook->address, 0, 0); 590 if (err) { 591 pr_warn("ftrace_set_filter_ip() failed: %d\n", err); 592 return err; 593 } 594 595 err = register_ftrace_function(&hook->ops); 596 if (err) { 597 pr_warn("register_ftrace_function() failed: %d\n", err); 598 ftrace_set_filter_ip(&hook->ops, hook->address, 1, 0); 599 return err; 600 } 601 return 0; 602 } 603 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip