tls access fails after runtime fix symbol lookups change
Stan Cox
scox@redhat.com
Fri May 14 20:42:17 GMT 2021
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.
More information about the Systemtap
mailing list