public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug translator/26670] New: In "end" probe, symbol lookup for user stacks is broken (print_usyms/print_ustack functions)
@ 2020-09-27 18:48 barrdetwix at gmail dot com
  2020-09-27 19:55 ` [Bug translator/26670] " mark at klomp dot org
  2020-09-27 21:44 ` barrdetwix at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: barrdetwix at gmail dot com @ 2020-09-27 18:48 UTC (permalink / raw)
  To: systemtap

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

            Bug ID: 26670
           Summary: In "end" probe, symbol lookup for user stacks is
                    broken (print_usyms/print_ustack functions)
           Product: systemtap
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: translator
          Assignee: systemtap at sourceware dot org
          Reporter: barrdetwix at gmail dot com
  Target Milestone: ---

I have a script that saves backtraces and tries defers resolving symbols until
the end, to reduce the overhead.

But it seems that resolving user symbols only works in regular probes, not in
the "end" probe. There is no error, the symbols just fail to resolve.
Note that there is no such problem for kernel stacks.

Version info:
Systemtap translator/driver (version 4.4/0.181, commit
release-4.3-75-g747902edd81a)
Linux 5.8.0-2-amd64 #1 SMP Debian 5.8.10-1 (2020-09-19) x86_64

Please see the following reproducer script (and the output I get below):

// stap_end_userstack.stp
global ustack;

probe vfs.read {
    ustack = ubacktrace();

    println("--- In vfs probe");
    print_usyms(ustack);
    exit();
}

probe end {
    println("--- In end probe");
    print_usyms(ustack);
}


$ sudo stap -d /bin/ntfs-3g -d /lib/x86_64-linux-gnu/libpthread-2.31.so -v
stap_end_userstack.stp
Pass 1: parsed user script and 476 library scripts using
93152virt/78928res/9964shr/69012data kb, in 140usr/30sys/170real ms.
Pass 2: analyzed script: 2 probes, 6 functions, 6 embeds, 1 global using
253976virt/241524res/11684shr/229836data kb, in 1500usr/130sys/1642real ms.
Pass 3: translated to C into
"/tmp/stapri4GCL/stap_7a0d3cf3937b410061615c1e75142f3c_4334_src.c" using
253976virt/241720res/11880shr/229836data kb, in 330usr/20sys/343real ms.
Pass 4: compiled C into "stap_7a0d3cf3937b410061615c1e75142f3c_4334.ko" in
8990usr/570sys/6673real ms.
Pass 5: starting run.
WARNING: Missing unwind data for a module, rerun with 'stap -d
/lib/x86_64-linux-gnu/libc-2.31.so'
--- In vfs probe
 0x7f65a1cb504e : __read+0xe/0xa0 [/lib/x86_64-linux-gnu/libpthread-2.31.so]
 0x55b8595b3012 : 0x55b8595b3012 [/bin/ntfs-3g+0x1a012/0x23000]
 0x55b8595ad26d : 0x55b8595ad26d [/bin/ntfs-3g+0x1426d/0x23000]
 0x55b85959f35f : 0x55b85959f35f [/bin/ntfs-3g+0x635f/0x23000]
 0x7f65a1aafcca : 0x7f65a1aafcca
[/lib/x86_64-linux-gnu/libc-2.31.so+0x26cca/0x1c1000]
--- In end probe
 0x7f65a1cb504e : 0x7f65a1cb504e
 0x55b8595b3012 : 0x55b8595b3012
 0x55b8595ad26d : 0x55b8595ad26d
 0x55b85959f35f : 0x55b85959f35f
 0x7f65a1aafcca : 0x7f65a1aafcca
Pass 5: run completed in 10usr/70sys/677real ms.

As you can see, the user stack resolves correctly in a regular probe, but not
in the end probe.

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

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

* [Bug translator/26670] In "end" probe, symbol lookup for user stacks is broken (print_usyms/print_ustack functions)
  2020-09-27 18:48 [Bug translator/26670] New: In "end" probe, symbol lookup for user stacks is broken (print_usyms/print_ustack functions) barrdetwix at gmail dot com
@ 2020-09-27 19:55 ` mark at klomp dot org
  2020-09-27 21:44 ` barrdetwix at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: mark at klomp dot org @ 2020-09-27 19:55 UTC (permalink / raw)
  To: systemtap

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

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at klomp dot org

--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
The problem is that in the end probe systemtap doesn't know with which user
space process the ustack backtrace addresses belong to (the process might even
no longer exist).

If you want to save the actual stack/symbols and use/print them in an end probe
you might want to use sprint_ustack or sprint_usyms.

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

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

* [Bug translator/26670] In "end" probe, symbol lookup for user stacks is broken (print_usyms/print_ustack functions)
  2020-09-27 18:48 [Bug translator/26670] New: In "end" probe, symbol lookup for user stacks is broken (print_usyms/print_ustack functions) barrdetwix at gmail dot com
  2020-09-27 19:55 ` [Bug translator/26670] " mark at klomp dot org
@ 2020-09-27 21:44 ` barrdetwix at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: barrdetwix at gmail dot com @ 2020-09-27 21:44 UTC (permalink / raw)
  To: systemtap

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

barrdetwix at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |NOTABUG

--- Comment #2 from barrdetwix at gmail dot com ---
Oh, of course. Now that you mention it, this obviously cannot work =)

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

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

end of thread, other threads:[~2020-09-27 21:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-27 18:48 [Bug translator/26670] New: In "end" probe, symbol lookup for user stacks is broken (print_usyms/print_ustack functions) barrdetwix at gmail dot com
2020-09-27 19:55 ` [Bug translator/26670] " mark at klomp dot org
2020-09-27 21:44 ` barrdetwix at gmail 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).