public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "wcohen at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug runtime/31309] New: Recent PIE binary support cause fileline-profile.stp example to crash the machine
Date: Mon, 29 Jan 2024 15:36:23 +0000	[thread overview]
Message-ID: <bug-31309-6586@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 31309
           Summary: Recent PIE binary support cause fileline-profile.stp
                    example to crash the machine
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: critical
          Priority: P2
         Component: runtime
          Assignee: systemtap at sourceware dot org
          Reporter: wcohen at redhat dot com
  Target Milestone: ---

When running the testsuite on recent git checkout systemtap the machine would
reboot when running fileline-profile.stp. Have observed this on x86_64 and
aarch64 machines.  This appears to be caused by:

commit d1ea490253710dc4d59e86ce5ba8ac7d3e7c537c                                 
Author: Martin Cermak <mcermak@redhat.com>                                      
Date:   Thu Jan 25 11:46:50 2024 +0100                                          

    PR26843: print_ubacktrace_fileline() fails with PIE binaries                

    Ubuntu has it's GCC configured with --enable-default-pie.  The              
    binaries it's producing by default are DYN (Position-Independent            
    Executable file).  This isn't reflected in the producer record.             
    For processing PIE binaries, additional relocation is needed in             
    the stap runtime.                                                           


This can be replicated with the following steps which the machine freezes and
then reboots after the staprun:

$ ../install/bin/stap -mx -v -p4
testsuite/systemtap.examples/profiling/fileline-profile.stp -T 6  --ldd
Pass 1: parsed user script and 533 library scripts using
540208virt/295592res/15488shr/279424data kb, in 570usr/90sys/817real ms.
Pass 2: analyzed script: 3 probes, 11 functions, 0 embeds, 3 globals using
553144virt/309544res/16512shr/292360data kb, in 50usr/0sys/62real ms.
Pass 3: translated to C into "/tmp/stapcBMDYH/x_src.c" using
554352virt/311592res/17408shr/293568data kb, in 30usr/290sys/877real ms.
x.ko
Pass 4: compiled C into "x.ko" in 22480usr/2500sys/25327real ms.
$ sudo ../install/bin/staprun x.ko -T 6

When commit d1ea49025 is removed the test runs successfully.

Remove patch
$ git show d1ea490253710dc4d59e86ce5ba8ac7d3e7c537c > x.patch
$ patch -R -p1 < x.patch 
patching file runtime/sym.c


$ make
$ sudo make install
...
$ ../install/bin/stap --disable-cache -my -v -p4
testsuite/systemtap.examples/profiling/fileline-profile.stp -T 6  --ldd
Pass 1: parsed user script and 533 library scripts using
540208virt/295724res/15616shr/279424data kb, in 540usr/70sys/609real ms.
Pass 2: analyzed script: 3 probes, 11 functions, 0 embeds, 3 globals using
553144virt/309676res/16640shr/292360data kb, in 50usr/10sys/62real ms.
Pass 3: translated to C into "/tmp/stapLlS876/y_src.c" using
554352virt/311724res/17536shr/293568data kb, in 10usr/60sys/74real ms.
y.ko
Pass 4: compiled C into "y.ko" in 20800usr/2340sys/23371real ms.
$ sudo ../install/bin/staprun y.ko -T 6
--- 6000 samples recorded:
k:0xffffffffb8fe14bf                                              5909
k:0xffffffffb81583da                                                24
k:0xffffffffc09d8ffb [y+0x6ffb/0x0]                                  6
k:0xffffffffc09d416f [y+0x216f/0x0]                                  5
k:0xffffffffc09d3944 [y+0x1944/0x0]                                  4
k:0xffffffffb8fe3730                                                 4
k:0xffffffffc09d9009 [y+0x7009/0x0]                                  3
k:0xffffffffc09d416c [y+0x216c/0x0]                                  2
k:0xffffffffb8ff9595                                                 2
k:0xffffffffc09d8ffe [y+0x6ffe/0x0]                                  2
k:0xffffffffb8207554                                                 2
k:0xffffffffb8ff8e4d                                                 2
k:0xffffffffb8189390                                                 1
k:0xffffffffb84b9324                                                 1
u:0x7f3626302161 [/usr/lib64/libc.so.6+0x108161/0x1da000]            1
k:0xffffffffb8ff1af0                                                 1
k:0xffffffffc09d4a73 [y+0x2a73/0x0]                                  1
k:0xffffffffb8fdb46b                                                 1
k:0xffffffffb8fd17eb                                                 1
k:0xffffffffb84971e3                                                 1

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

             reply	other threads:[~2024-01-29 15:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-29 15:36 wcohen at redhat dot com [this message]
2024-01-29 15:51 ` [Bug runtime/31309] " mcermak at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-31309-6586@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).