Bug 6601 - systemtap with --kelf option looks for data symbol to probe a function on powerpc systemtap
Summary: systemtap with --kelf option looks for data symbol to probe a function on pow...
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: translator (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-06 10:16 UTC by Srinivasa DS
Modified: 2008-06-10 20:22 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Possible fix: rejects symbols in .odp section (1.10 KB, patch)
2008-06-06 23:45 UTC, Jim Keniston
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Srinivasa DS 2008-06-06 10:16:16 UTC
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
===========================================
Comment 1 Jim Keniston 2008-06-06 23:45:20 UTC
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.
Comment 2 Srinivasa DS 2008-06-09 11:11:57 UTC
(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.

Comment 3 Jim Keniston 2008-06-09 18:45:14 UTC
Fix pushed today, commit 46f7b6b.
Comment 4 Jim Keniston 2008-06-10 20:22:53 UTC
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.