Environment: Kernel-2.6.26-rc4, systemtap-latest git, elfutils-0.131 systemtaps with kelf option fails on powerpc systems with -EINVAL. To do more investigation, I printed relocated address along with "probe registration" error message. Address shows data symbol("D" in /proc/kallsyms) address of probe point. Even stap-symbols.h shows both the text and data symbol address of some functions. ================================= [root@llm16 systemtap-6jun]# ./stap -v -k --kelf -e 'probe kernel.function("do_exit") { printf("hi\n")}' Pass 1: parsed user script and 41 library script(s) in 680usr/20sys/698real ms. Pass 2: analyzed script: 1 probe(s), 0 function(s), 0 embed(s), 0 global(s) in 250usr/20sys/271real ms. Pass 3: using cached /root/.systemtap/cache/90/stap_904bc7d6ba7dfba9b5e96f62b96b5472_233.c Pass 4: using cached /root/.systemtap/cache/90/stap_904bc7d6ba7dfba9b5e96f62b96b5472_233.ko Pass 5: starting run. ERROR: probe kernel.function("do_exit@?") registration error (rc 0xc000000000630838 -22) <<============ reloacted_address shows data sym addr Pass 5: run completed in 0usr/50sys/59real ms. Keeping temporary directory "/tmp/stapvPDT0F" [root@llm16 systemtap-6jun]# cat /proc/kallsyms | grep do_exit c000000000058450 T .do_exit c0000000004f6a68 d __ksymtab_do_exit c0000000004fee40 d __kcrctab_do_exit c000000000501be9 r __kstrtab_do_exit c000000000630838 D do_exit ===========================================
Created attachment 2774 [details] Possible fix: rejects symbols in .odp section Hmmm. Apparently at least some function-descriptor symbols like do_exit show up in elf as type STT_FUNC even though nm labels them "D". (You don't see this problem with --kmap=/proc/kallsyms --ignore-vmlinux, do you?) One way to screen these out is to reject all symbols in the .opd section. The attached patch does that. Please give it a try and let me know how it works.
(In reply to comment #1) > Created an attachment (id=2774) > Possible fix: rejects symbols in .odp section > > Hmmm. Apparently at least some function-descriptor symbols like do_exit show > up in elf as type STT_FUNC even though nm labels them "D". (You don't see this > problem with --kmap=/proc/kallsyms --ignore-vmlinux, do you?) I tried with --kmap option, But it didn't work as --kelf, > One way to > screen these out is to reject all symbols in the .opd section. The attached > patch does that. Please give it a try and let me know how it works. After applying the patch, stap worked well with --kelf and --kmap option.
Fix pushed today, commit 46f7b6b.
The systemtap.context/num_args test, augmented today to test with --kelf --ignore-dwarf, should serve as a regression test for this bug. Closing this PR.