RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 819967 - caller() doesn't work in systemtap
Summary: caller() doesn't work in systemtap
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: systemtap
Version: 6.3
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: rc
: ---
Assignee: Frank Ch. Eigler
QA Contact: Martin Cermak
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-05-08 18:33 UTC by Michael S. Tsirkin
Modified: 2013-11-21 11:44 UTC (History)
6 users (show)

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.
Clone Of:
: 1013202 (view as bug list)
Environment:
Last Closed: 2013-11-21 11:44:13 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:1630 0 normal SHIPPED_LIVE systemtap bug fix and enhancement update 2013-11-20 21:53:53 UTC
Sourceware 6580 0 P2 RESOLVED revamp backtrace-related tapset functions 2020-03-17 15:25:54 UTC
Sourceware 14079 0 P2 RESOLVED caller() pass-4 error if no uretprobes in script 2020-03-17 15:25:54 UTC

Description Michael S. Tsirkin 2012-05-08 18:33:16 UTC
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 18:39:01 UTC
upstream commit #4107dbc2c885 corrects this.

Comment 2 Michael S. Tsirkin 2012-05-08 18:43:54 UTC
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 18:51:49 UTC
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 18:56:05 UTC
Upstream commit makes the stap script compile again:

commit 4107dbc2c88536c3374a68948c7344af8c8e75aa
Author: Mark Wielaard <mjw>
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 18:59:13 UTC
> 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 Program Management 2012-07-10 08:38:19 UTC
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 Program Management 2012-07-11 01:51:40 UTC
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 22:39:11 UTC
Resetting to devel_ack?, to wait for PR6580 (inclusion of caller_* in the tapset).

Comment 13 Frank Ch. Eigler 2012-10-18 15:21:28 UTC
upstream systemtap-2.0 includes full PR6580 goodness.

Comment 22 errata-xmlrpc 2013-11-21 11:44:13 UTC
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.