From: Stan Cox <scox@redhat.com>
To: Sultan Alsawaf <sultan@openresty.com>
Cc: systemtap@sourceware.org
Subject: tls access fails after runtime fix symbol lookups change
Date: Mon, 10 May 2021 17:57:00 -0400 [thread overview]
Message-ID: <09ad40e1-86b6-f8f9-3626-ab31f0f41e7a@redhat.com> (raw)
Sultan,
The thread local storage access stopped working after:
runtime: fix symbol lookups when the first section isn't executable
Some binaries are linked in such a way that there are VMA address
range gaps, indicated by non-zero load offsets. The runtime needs to
not lose those offsets to enable a proper mapping back & forth from
addresses to symbols.
runtime/sym.c | 12 ++++++------
runtime/task_finder_vma.c | 9 +++++++--
runtime/unwind.c | 2 +-
runtime/vma.c | 31 ++++++++++---------------------
4 files changed, 24 insertions(+), 30 deletions(-)
More specifically, what fails is accessing the module list; which is the
list of executable and libraries. That list is used to find the correct
entry for a given module. A quick way to test this is:
RUNTESTFLAGS='tls.exp' make installcheck
After the above is run, a more specific check can be done by executing
this (access module list directly) in the testsuite directory.
% ../../install/bin/stap -DTIF_IA32=99 --disable-cache --runtime=kernel
-g -c /work/scox/systemtap/bld/testsuite/tls1.x -e 'probe
process.function("main")
{printf("%#lx\n",user_long_error(&@var("_rtld_global","/usr/lib64/ld-linux-x86-64.so.2")->_dl_ns[0]->_ns_loaded));}'
; ../../install/bin/stap -DTIF_IA32=99 --disable-cache --runtime=kernel
-g -c /work/scox/systemtap/bld/testsuite/tls1.x -e 'probe
process.function("main")
{printf("%#s\n",(@var("_rtld_global","/usr/lib64/ld-linux-x86-64.so.2")->_dl_ns[0]->_ns_loaded$));}'
tls counter for 1: 2/3
tls counter for 2: 3/4
0x7efc51d761a0
tls counter for 1: 2/3
tls counter for 2: 3/4
{.l_addr=0, .l_name="", .l_ld=0x403dd8, .l_next=0x7f11692c5750,
.l_prev=0x0, .l_real=0x7f11692c51a0, .l_ns=0, .l_libname=0x7f11692c5728,
.l_info=[...], .l_phdr=0x400040, .l_entry=4198496, .l_phnum=12,
.l_ldnum=0, .l_searchlist={...}, .l_symbolic_searchlist={...},
.l_loader=0x0, .l_versions=0x7f1169272530, .l_nversions=4,
.l_nbuckets=1, .l_gnu_bitmask_idxbits=0, .l_gnu_shift=0,
.l_gnu_bitmask=0x400350, <union>={...}, <union>={...},
.l_direct_opencount=1, .l_type=0, .l_relocated=1, .l_init_called=1,
.l_globa...
Failing result:
tls counter for 1: 2/3
tls counter for 2: 3/4
ERROR: read fault [man error::fault] at 0x7f84a4ac9000 near identifier
'user_long_error' at
/work/scox/teststap/bld/../install/share/systemtap/tapset/uconversions.stp:687:10
WARNING: Number of errors: 1, skipped probes: 0
WARNING: /work/scox/teststap/bld/../install/bin/staprun exited with
status: 1
Pass 5: run failed. [man error::pass5]
tls counter for 1: 2/3
tls counter for 2: 3/4
ERROR
Change to user mode (--runtime=dyninst), and it works okay.
next reply other threads:[~2021-05-10 21:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-10 21:57 Stan Cox [this message]
2021-05-14 20:42 ` Stan Cox
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=09ad40e1-86b6-f8f9-3626-ab31f0f41e7a@redhat.com \
--to=scox@redhat.com \
--cc=sultan@openresty.com \
--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).