This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[Bug kprobes/9999] New: Guarantee real return address in kretprobe_instance
- From: "jkenisto at us dot ibm dot com" <sourceware-bugzilla at sourceware dot org>
- To: systemtap at sources dot redhat dot com
- Date: 24 Mar 2009 23:30:47 -0000
- Subject: [Bug kprobes/9999] New: Guarantee real return address in kretprobe_instance
- Reply-to: sourceware-bugzilla at sourceware dot org
The tapset function caller_addr() assumes that the return address in the
kretprobe_instance associated with the currently running handler contains the
actual return address. This is true for the first (chronologically)
kretprobe_instance created when a function is called. But if you have more than
one kretprobe on a particular function, the other kretprobe_instances will have
ret_addr = kretprobe_trampoline.
Rather than expecting SystemTap runtime code to sort this out, kprobes could
scan the kretprobe_instance hash list to find the real return address, then
insert it into each kretprobe_instance before calling the associated handler.
This could also show up as a new kretprobe_get_nth_ret_addr(N) function -- we'd
probably need locked and unlocked versions -- which could be called by backtrace
code the Nth time it finds the kretprobe_trampoline address where it wants a
return address. (See PR #6436.)
----- caller.stp -----
probe kernel.function("do_fork").return {
printf("1. %s called from %#x\n", probefunc(), caller_addr())
}
probe kernel.function("do_fork").return {
printf("2. %s called from %#x\n", probefunc(), caller_addr())
}
probe kernel.function("do_fork").return {
printf("3. %s called from %#x\n", probefunc(), caller_addr())
}
-----
$ stap -v caller.stp
Pass 1: parsed user script and 50 library script(s) in 510usr/10sys/940real ms.
Pass 2: analyzed script: 3 probe(s), 2 function(s), 2 embed(s), 0 global(s) in
360usr/410sys/24941real ms.
Pass 3: using cached
/home/jimk/.systemtap/cache/35/stap_352a103d8dba5083fe89c381c1554361_2100.c
Pass 4: using cached
/home/jimk/.systemtap/cache/35/stap_352a103d8dba5083fe89c381c1554361_2100.ko
Pass 5: starting run.
1. do_fork called from 0xffffffffc02a2d67
2. do_fork called from 0xffffffffc02a2d67
3. do_fork called from 0xffffffffc01016db
1. do_fork called from 0xffffffffc02a2d67
2. do_fork called from 0xffffffffc02a2d67
3. do_fork called from 0xffffffffc01016db
^CPass 5: run completed in 10usr/10sys/4372real ms.
$
--
Summary: Guarantee real return address in kretprobe_instance
Product: systemtap
Version: unspecified
Status: NEW
Severity: minor
Priority: P2
Component: kprobes
AssignedTo: systemtap at sources dot redhat dot com
ReportedBy: jkenisto at us dot ibm dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=9999
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.