Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 819967 - caller() doesn't work in systemtap
caller() doesn't work in systemtap
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: systemtap (Show other bugs)
6.3
Unspecified Unspecified
unspecified Severity low
: rc
: ---
Assigned To: Frank Ch. Eigler
Martin Cermak
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-08 14:33 EDT by Michael S. Tsirkin
Modified: 2013-11-21 06:44 EST (History)
6 users (show)

See Also:
Fixed In Version: systemtap-2.3-1.el6
Doc Type: Bug Fix
Doc Text:
Cause: The systemtap translator wasn't always including the proper code to be able to use the 'caller()' function. Consequence: Some uses of the systemtap 'caller()' function can cause compile errors. Fix: Modify systemtap to make sure that when the 'caller()' function is used the proper runtime code gets included. Result: Use of the systemtap 'caller()' function does not cause compile errors.
Story Points: ---
Clone Of:
: 1013202 (view as bug list)
Environment:
Last Closed: 2013-11-21 06:44:13 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Sourceware 14079 None None None Never
Sourceware 6580 None None None Never
Red Hat Product Errata RHBA-2013:1630 normal SHIPPED_LIVE systemtap bug fix and enhancement update 2013-11-20 16:53:53 EST

  None (edit)
Description Michael S. Tsirkin 2012-05-08 14:33:16 EDT
Description of problem:
using caller() in systemtap scripts does not work.
I think it worked in rhel5 but not sure.

Version-Release number of selected component (if applicable):
systemtap-1.7-3.el6.x86_64


How reproducible:

always

Steps to Reproduce:
1.create a script test.stp:
probe kernel.function("netif_receive_skb@net/core/dev.c"){ printf("netif_receive_skb %x from %s\n", $skb->ip_summed, caller());  }

2. run stap test.stp
  
Actual results:
fails with:
/tmp/stapkxUVo5/stap_40abae8a2d169ccb615c8254b8f81199_3385_src.c: In function ‘function_caller_addr’:
/tmp/stapkxUVo5/stap_40abae8a2d169ccb615c8254b8f81199_3385_src.c:564: error: dereferencing pointer to incomplete type
make[1]: *** [/tmp/stapkxUVo5/stap_40abae8a2d169ccb615c8254b8f81199_3385_src.o] Error 1
make: *** [_module_/tmp/stapkxUVo5] Error 2
WARNING: make exited with status: 2
Pass 4: compilation failed.  Try again with another '--vp 0001' option.



Expected results:
prints
netif_receive_skb X from <caller>
for each received packet

Additional info:
Comment 1 Frank Ch. Eigler 2012-05-08 14:39:01 EDT
upstream commit #4107dbc2c885 corrects this.
Comment 2 Michael S. Tsirkin 2012-05-08 14:43:54 EDT
additional info:
adding a userspace probe:
probe process("gcc").function("main").return { printf("%s\n", backtrace());}
as a work around
makes it not fail but it still does not work:

netif_receive_skb 1 from 0x0 0x0


instead of from <function name>
Comment 3 Michael S. Tsirkin 2012-05-08 14:51:49 EDT
here's a workaround avoiding caller():

function caller_n(n) {
     f = backtrace ()
     sym = tokenize(f, " ")
     for (i=1; i<n; i++)
        sym = tokenize("", " ")
     return sym
}

probe module("tun").function("tun_net_xmit@drivers/net/tun.c")  { printf("tun_net_xmit %x from %s\n", $skb->ip_summed, symdata(strtol(caller_n(1),16))); }  
probe kernel.function("dev_hard_start_xmit@net/core/dev.c"){ printf("dev_queue_start_xmit %x from %s\n", $skb->ip_summed, symdata(strtol(caller_n(1),16)));  }
probe kernel.function("netif_receive_skb@net/core/dev.c"){ printf("netif_receive_skb %x from %s\n", $skb->ip_summed, symdata(strtol(caller_n(1),16)));  }
Comment 5 Mark Wielaard 2012-05-08 14:56:05 EDT
Upstream commit makes the stap script compile again:

commit 4107dbc2c88536c3374a68948c7344af8c8e75aa
Author: Mark Wielaard <mjw@redhat.com>
Date:   Tue May 8 19:59:07 2012 +0200

    PR14079 - caller() pass-4 error if no uretprobes in script
    
    caller() is odd in that it tries to do both kernel and user caller.
    There is no ucaller(). Move it into its own tapset and include the
    right uprobes related structures.
    
    * runtime/uprobes-inc.h: New include file to be included in ...
    * runtime/stack.c: here and ...
    * tapset/context-caller.stp: here. New tapset, with just the caller context
      function, removed from ...
    * tapset/context-unwind.stp: here.
    * doc/SystemTap_Tapset_Reference/tapsets.tmpl: Also include context-caller.s
Comment 6 Mark Wielaard 2012-05-08 14:59:13 EDT
> makes it not fail but it still does not work:
>
> netif_receive_skb 1 from 0x0 0x0

That was because caller() only works for return probes. And this was a call probe.
Comment 10 RHEL Product and Program Management 2012-07-10 04:38:19 EDT
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.
Comment 11 RHEL Product and Program Management 2012-07-10 21:51:40 EDT
This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development.  This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.
Comment 12 Frank Ch. Eigler 2012-08-10 18:39:11 EDT
Resetting to devel_ack?, to wait for PR6580 (inclusion of caller_* in the tapset).
Comment 13 Frank Ch. Eigler 2012-10-18 11:21:28 EDT
upstream systemtap-2.0 includes full PR6580 goodness.
Comment 22 errata-xmlrpc 2013-11-21 06:44:13 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-1630.html

Note You need to log in before you can comment on or make changes to this bug.