Bug 6416 - SystemTap should recognize and disble probes on __devinit/__devexit functions
Summary: SystemTap should recognize and disble probes on __devinit/__devexit functions
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: runtime (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Srinivasa DS
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-16 09:26 UTC by Ananth Mavinakayanahalli
Modified: 2008-04-23 19:06 UTC (History)
1 user (show)

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


Attachments
Patch to disallow probing __devinit/exit,__cpuint/exit,__meminit/exit section symbols. (338 bytes, patch)
2008-04-18 08:37 UTC, Srinivasa DS
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ananth Mavinakayanahalli 2008-04-16 09:26:55 UTC
stap on a simple script:

probe kernel.function("*@drivers/net/ibmveth.c")
{
   printf("%s\n", probefunc());
}

fails with the following error:

ERROR: probe kernel.function("ibmveth_probe@drivers/net/ibmveth.c:1103")
registration error (rc -22)
stapio:stp_main_loop:301 probe_start() returned -1
stapio:cleanup_and_exit:216 CLEANUP AND EXIT  closed=1

This is because ibmveth_probe is annotated __devinit and as such will be
discarded after device initialization. Similarly for __devexit functions also.

Like is currently done with __init and __exit section symbols, SystemTap must
recognize and not probe __devinit/__devexit section symbols too.
Comment 1 Srinivasa DS 2008-04-18 08:37:17 UTC
Created attachment 2712 [details]
Patch to disallow probing __devinit/exit,__cpuint/exit,__meminit/exit section symbols.

This patch disallows user from probing __dev,__cpu,__mem(init/exit) functions
and solves the problem. 

Thanks
 Srinivasa DS
Comment 2 Frank Ch. Eigler 2008-04-21 15:41:16 UTC
The patch looks good to me, though in my x86-64 machines, I can find no such
sections/symbols anyway.
Comment 3 Srinivasa DS 2008-04-22 06:27:36 UTC
(In reply to comment #2)
> The patch looks good to me, though in my x86-64 machines, I can find no such
> sections/symbols anyway.

Frank
 Thanks for the review.
I could see this, in my ppc system, 
[root@llm27lp1 ~]# readelf --sections /boot/vmlinux-2.6.25-rc7 | grep init
  [ 3] .cpuinit.text     PROGBITS         c000000000401b58  00411b58
  [ 4] .devinit.text     PROGBITS         c00000000040506c  0041506c
  [ 5] .meminit.text     PROGBITS         c0000000004212e4  004312e4
Comment 4 Frank Ch. Eigler 2008-04-23 19:06:59 UTC
commit f90f926