public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Stan Cox <scox@redhat.com>
To: Sultan Alsawaf <sultan@openresty.com>
Cc: systemtap@sourceware.org
Subject: Re: tls access fails after runtime fix symbol lookups change
Date: Fri, 14 May 2021 16:42:17 -0400	[thread overview]
Message-ID: <a01716e1-542d-815b-70fa-37f2dfff8d1d@redhat.com> (raw)
In-Reply-To: <09ad40e1-86b6-f8f9-3626-ab31f0f41e7a@redhat.com>

I poked at this by adding additional debug statements:

dbug_task_vma(1, ...
if (res == -ESRCH /*|| vm_start + offset == addr*/)
     res = stap_add_vma_map_info(tsk->group_leader,
           addr, addr + length,
	  offset, path, module);
else if (res == 0 && vm_end + 1 == addr)
     res = stap_extend_vma_map_info(tsk->group_leader,
	  vm_start, addr + length);

stap -DDEBUG_TASK_FINDER=2 -DDEBUG_TASK_FINDER_VMA=2 --disable-cache 
--runtime=kernel -g -c 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$);
 
printf("%#lx\n",&@var("_rtld_global","/usr/lib64/ld-linux-x86-64.so.2")->_dl_ns[0]->_ns_loaded);
   }'


and notice:

The module map that tls accesses is at 0x7fb941037000
This is with vm_start+offset==addr commented out

Immediately before condition in question:

_stp_vma_mmap_cb:188: At vm check res 0/-3 vm_start+offset==addr 1 
vm_end+1==addr 0 vm_start 0x7fb94100b000 vm_end 0x7fb94100c000 offset 
0x22000 addr 0x7fb94102d000 length 0x9000 addr+length 0x7fb941036000

So both conditions are false so no stap_add_vma_map_info or
stap_extend_vma_map_info

and a bit later:

_stp_vma_mmap_cb:158: mmap_cb: tsk 88624:88624 path 
/usr/lib64/ld-2.32.so, addr 0x7fb941036000, length 0x00003000, offset 
0x2a000, flags 0x810087

_stp_vma_mmap_cb:188: At vm check res 0/-3 vm_start+offset==addr 0 
vm_end+1==addr 0 vm_start 0x7fb94100b000 vm_end 0x7fb94100c000 offset 
0x2a000 addr 0x7fb941036000 length 0x3000 addr+length 0x7fb941039000

again both conditions are false, so neither stap_add_vma_map_info nor
stap_extend_vma_map_info, (so how is it stap knows about 0x7fb941037000?)

works as expected

{.l_addr=0, .l_name="", .l_ld=0x403dd8, .l_next=0x7fb941038750, 
.l_prev=0x0, .l_real=0x7fb9410381a0, .l_ns=0, .l_libname=0x7fb941038728, 
.l_info=[...], .l_phdr=0x400040, .l_entry=4198496, .l_phnum=12, 
.l_ldnum=0, .l_searchlist={...}, .l_symbolic_searchlist={...}, 
.l_loader=0x0, .l_versions=0x7fb940fe5530, .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
0x7fb941037000

Now if vm_start+offset==addr is active where the module map is at 
0x7fe9fa65e000

_stp_vma_mmap_cb:188: At vm check res 0/-3 vm_start+offset==addr 1 
vm_end+1==addr 0 vm_start 0x7fe9fa608000 vm_end 0x7fe9fa629000 offset 
0x2a000 addr 0x7fe9fa632000 length 0x3000 addr+length 0x7fe9fa635000

In this case stap_add_vma_map_info does get called

stap_add_vma_map_info:223: stap_add_vma_map_info adding 
'/usr/lib64/ld-2.32.so' for 83155 [7fe9fa632000-7fe9fa635000 2a000]

ERROR
0x7fe9fa65e000

That seems to be the primary difference.


      reply	other threads:[~2021-05-14 20:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10 21:57 Stan Cox
2021-05-14 20:42 ` Stan Cox [this message]

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=a01716e1-542d-815b-70fa-37f2dfff8d1d@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).