public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug tapsets/20982] New: function::stack doesn't descend if _stack_raw() fails
@ 2016-12-19 15:39 bcodding at redhat dot com
  2016-12-19 17:03 ` [Bug tapsets/20982] " fche at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: bcodding at redhat dot com @ 2016-12-19 15:39 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=20982

            Bug ID: 20982
           Summary: function::stack doesn't descend if _stack_raw() fails
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tapsets
          Assignee: systemtap at sourceware dot org
          Reporter: bcodding at redhat dot com
  Target Milestone: ---

On 4.8.13-100.fc23.x86_64, it seems vmlinux is missing unwind data.  If so, the
stack() function ought to fall back to using backtrace(), but this
functionality has been broken since commit 700d493 "PR14900: fix collisions
between context tapset locals and user globals"

Note in the following output's last line, the return value of stack(0) and
stack(N) will always be equal:

# stap -DDEBUG_UNWIND=3 -e 'probe kernel.function("get_seconds") {
printf("stack 0 is %p, stack 1 is %p\n", stack(0), stack(1)); exit() }'
_stp_stack_unwind_one_kernel:272: STARTING kernel unwind
0xffffffff83116840 _stp_stack_unwind_one_kernel:307: CONTINUING kernel unwind
to depth 1
unwind:1478: pc=ffffffff83116840, ffffffff83116840
unwind:1521: trying debug_frame
set_no_state_rule:249: reg=10, where=1
_stp_search_unwind_hdr:775: binary search for ffffffff83116840
adjustStartLoc:725: adjustStartLoc=ffffffff814449b0, ptrType=DW_EH_PE_absptr,
m=/usr/lib/debug/lib/modules/4.8.13-100.fc23.x86_64/vmlinux, s=_stext eh=0
adjustStartLoc:725: adjustStartLoc=ffffffff81648d80, ptrType=DW_EH_PE_absptr,
m=/usr/lib/debug/lib/modules/4.8.13-100.fc23.x86_64/vmlinux, s=_stext eh=0
adjustStartLoc:725: adjustStartLoc=ffffffff81769ee0, ptrType=DW_EH_PE_absptr,
m=/usr/lib/debug/lib/modules/4.8.13-100.fc23.x86_64/vmlinux, s=_stext eh=0
adjustStartLoc:725: adjustStartLoc=ffffffff81f8a969, ptrType=DW_EH_PE_absptr,
m=/usr/lib/debug/lib/modules/4.8.13-100.fc23.x86_64/vmlinux, s=_stext eh=0
adjustStartLoc:725: adjustStartLoc=ffffffff81fbfb32, ptrType=DW_EH_PE_absptr,
m=/usr/lib/debug/lib/modules/4.8.13-100.fc23.x86_64/vmlinux, s=_stext eh=0
adjustStartLoc:725: adjustStartLoc=ffffffff81fda19a, ptrType=DW_EH_PE_absptr,
m=/usr/lib/debug/lib/modules/4.8.13-100.fc23.x86_64/vmlinux, s=_stext eh=0
adjustStartLoc:725: adjustStartLoc=ffffffff81fe6cc8, ptrType=DW_EH_PE_absptr,
m=/usr/lib/debug/lib/modules/4.8.13-100.fc23.x86_64/vmlinux, s=_stext eh=0
adjustStartLoc:725: adjustStartLoc=ffffffff820f2f33, ptrType=DW_EH_PE_absptr,
m=/usr/lib/debug/lib/modules/4.8.13-100.fc23.x86_64/vmlinux, s=_stext eh=0
adjustStartLoc:725: adjustStartLoc=ffffffff820f3765, ptrType=DW_EH_PE_absptr,
m=/usr/lib/debug/lib/modules/4.8.13-100.fc23.x86_64/vmlinux, s=_stext eh=0
adjustStartLoc:725: adjustStartLoc=ffffffff820f3db9, ptrType=DW_EH_PE_absptr,
m=/usr/lib/debug/lib/modules/4.8.13-100.fc23.x86_64/vmlinux, s=_stext eh=0
adjustStartLoc:725: adjustStartLoc=ffffffff820f4214, ptrType=DW_EH_PE_absptr,
m=/usr/lib/debug/lib/modules/4.8.13-100.fc23.x86_64/vmlinux, s=_stext eh=0
adjustStartLoc:725: adjustStartLoc=ffffffff820f42e4, ptrType=DW_EH_PE_absptr,
m=/usr/lib/debug/lib/modules/4.8.13-100.fc23.x86_64/vmlinux, s=_stext eh=0
adjustStartLoc:725: adjustStartLoc=ffffffff820f4389, ptrType=DW_EH_PE_absptr,
m=/usr/lib/debug/lib/modules/4.8.13-100.fc23.x86_64/vmlinux, s=_stext eh=0
adjustStartLoc:725: adjustStartLoc=ffffffff820f43b9, ptrType=DW_EH_PE_absptr,
m=/usr/lib/debug/lib/modules/4.8.13-100.fc23.x86_64/vmlinux, s=_stext eh=0
adjustStartLoc:725: adjustStartLoc=ffffffff820f43e1, ptrType=DW_EH_PE_absptr,
m=/usr/lib/debug/lib/modules/4.8.13-100.fc23.x86_64/vmlinux, s=_stext eh=0
adjustStartLoc:725: adjustStartLoc=ffffffff820f445a, ptrType=DW_EH_PE_absptr,
m=/usr/lib/debug/lib/modules/4.8.13-100.fc23.x86_64/vmlinux, s=_stext eh=0
adjustStartLoc:725: adjustStartLoc=ffffffff820f445a, ptrType=DW_EH_PE_absptr,
m=/usr/lib/debug/lib/modules/4.8.13-100.fc23.x86_64/vmlinux, s=_stext eh=0
_stp_search_unwind_hdr:840: fde off=1f1b50
_stp_search_unwind_hdr:850: returning fde=ffffffffc0b3eaf0
startLoc=ffffffff820f445a
unwind_frame:1194: /usr/lib/debug/lib/modules/4.8.13-100.fc23.x86_64/vmlinux:
fde=ffffffffc0b3eaf0
unwind_frame:1199: /usr/lib/debug/lib/modules/4.8.13-100.fc23.x86_64/vmlinux:
cie=ffffffffc0b3e9d8
parse_fde_cie:142: codeAlign=1, dataAlign=fffffffffffffff8
parse_fde_cie:156: map retAddrReg value 16 to reg_info idx 16
parse_fde_cie:220: startLoc: ffffffff820f445a, locrange: 34
adjustStartLoc:725: adjustStartLoc=ffffffff820f445a, ptrType=DW_EH_PE_absptr,
m=/usr/lib/debug/lib/modules/4.8.13-100.fc23.x86_64/vmlinux, s=_stext eh=0
unwind_frame:1214: startLoc: ffffffff820f445a, endLoc: ffffffff820f448e
unwind_frame:1216: pc (ffffffff83116840) > endLoc(ffffffff820f448e)
unwind:1525: debug_frame failed: 1, trying eh_frame
unwind_frame:1178: Module
/usr/lib/debug/lib/modules/4.8.13-100.fc23.x86_64/vmlinux: no unwind frame data
unwind:1533: unwinding failed: -5
_stp_stack_unwind_one_kernel:325: ret=-5 PC=ffffffff83116840
SP=ffff9e1479eafdb0
stack 0 is 0xffffffff83116840, stack 1 is 0xffffffff83116840

The following hack (fix?) resolves the problem for me:
diff --git a/tapset/linux/context-symbols.stp
b/tapset/linux/context-symbols.stp
index 0585ca3..e710209 100644
--- a/tapset/linux/context-symbols.stp
+++ b/tapset/linux/context-symbols.stp
@@ -34,13 +34,13 @@ function stack:long (n:long) {
          if (__r != 0) return __r

          /* fallback: parse backtrace() to go deeper in the stack */
-         __b = backtrace (); __orig_n = __n;
+         __b = backtrace (); __orig_n = n;
          __sym = tokenize (__b, " ");
          if (__sym == "") @__context_unwind_error(__orig_n);
-         while (__n > 0) {
+         while (n > 0) {
                __sym = tokenize ("", " ");
                if (__sym == "") @__context_unwind_error(__orig_n);
-               __n--;
+               n--;
          }
          return strtol(__sym, 16)
 }

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug tapsets/20982] function::stack doesn't descend if _stack_raw() fails
  2016-12-19 15:39 [Bug tapsets/20982] New: function::stack doesn't descend if _stack_raw() fails bcodding at redhat dot com
@ 2016-12-19 17:03 ` fche at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: fche at redhat dot com @ 2016-12-19 17:03 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=20982

Frank Ch. Eigler <fche at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |fche at redhat dot com
           Assignee|systemtap at sourceware dot org    |fche at redhat dot com

--- Comment #1 from Frank Ch. Eigler <fche at redhat dot com> ---
Excellent catch.  There were several similar typos in the commit you
identified.
Interestingly, our symbol resolution rules permit globals & function parameters
to have the same name, and the latter "win" (bind tighter).

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-19 17:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-19 15:39 [Bug tapsets/20982] New: function::stack doesn't descend if _stack_raw() fails bcodding at redhat dot com
2016-12-19 17:03 ` [Bug tapsets/20982] " fche at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).