public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* tls access fails after runtime fix symbol lookups change
@ 2021-05-10 21:57 Stan Cox
  2021-05-14 20:42 ` Stan Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Stan Cox @ 2021-05-10 21:57 UTC (permalink / raw)
  To: Sultan Alsawaf; +Cc: systemtap

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.


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

end of thread, other threads:[~2021-05-14 20:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10 21:57 tls access fails after runtime fix symbol lookups change Stan Cox
2021-05-14 20:42 ` Stan Cox

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).