Bug 22004 - dyninst does not handle R_*_IRELATIV in .rela.plt
Summary: dyninst does not handle R_*_IRELATIV in .rela.plt
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: dyninst (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-24 21:24 UTC by Stan Cox
Modified: 2017-11-03 18:53 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stan Cox 2017-08-24 21:24:00 UTC

    
Comment 1 Stan Cox 2017-08-24 21:25:06 UTC
The problem seems related to the expanded use of ifunc in libc 2.25.90. This could occur with any use of ifunc most probably, it just so happens recent libc has expanded use of it so we will probably see expanded use of it:
ifunc description

Going through the last few stack frame entries where things go awry:

frame 5 0x00007fca65776c99 in Dyninst::ParseAPI::CFGFactory::_mkfunc (this=this@entry=0x9aa2c0, addr=addr@entry=132480,
src=src@entry=Dyninst::ParseAPI::RT, name="targ20580", obj=obj @Entry=0x1076590, reg=reg@entry=0x1d058f0, isrc=0x21744c0)
at /root/brew-rpms/dyninst-9.3.2-1/BUILD/dyninst-9.3.2/dyninst-9.3.2/parseAPI/src/CFGFactory.C:91
91 Function * ret = mkfunc(addr,src,name,obj,reg,isrc);

where addr = 0x20580 is
Disassembly of section .plt:
0000000000020580 <ABS+0x98e00 at plt>:
20580: ff 25 fa 0a 3c 00 jmpq *0x3c0afa(%rip) # 3e1080 <GLOBAL_OFFSET_TABLE+0x80>
20586: 68 19 00 00 00 pushq $0x19
2058b: e9 10 ff ff ff jmpq 204a0 <catch_hook+0x20418>

where 3e1080 is
Relocation section '.rela.plt' at offset 0x200f0 contains 39 entries:
Offset Info Type Sym. Value Sym. Name + Addend
...
0000003e1080 000000000025 R_X86_64_IRELATIV 98e00

where 98e00 is
Symbol table '.dynsym' contains 2294 entries:
793: 0000000000098e00 42 IFUNC GLOBAL DEFAULT 13 strlen @@ GLIBC_2.2.5

frame 4 0x00007fca65d98813 in DynCFGFactory::mkfunc (this=this @ entry=0x9aa2c0, addr=addr@entry=132480,
src=src@entry=Dyninst::ParseAPI::RT, name="", obj=obj @ entry=0x1076590, reg=reg@entry=0x1d058f0, isrc=)
at /root/brew-rpms/dyninst-9.3.2-1/BUILD/dyninst-9.3.2/dyninst-9.3.2/dyninstAPI/src/Parsing.C:164
164 ret = new parse_func(stf, pdmod,_img,obj,reg,isrc,src);

where stf is stf = new PLTFunction(*i);
(if I understand things correctly a function object is being created for the plt entry)
where *i is the relocation for this plt entry. For ifunc this is the R_*IRELATIV relocation.
this results in stf.firstSymbol = NULL

frame 3 0x00007fca65d7b5c0 in parse_func::parse_func (this=0x2613a10, func=0x2611c60, m=0x8c5770, i=0x816e50, obj=0x1076590,
reg=0x1d058f0, isrc=0x21744c0, src=Dyninst::ParseAPI::RT)
at /root/brew-rpms/dyninst-9.3.2-1/BUILD/dyninst-9.3.2/dyninst-9.3.2/dyninstAPI/src/parse-cfg.C:91
91 Function(func->getOffset(),func->getFirstSymbol()->getMangledName(),obj,reg,isrc),

where func->getFirstSymbol() is NULL so we get a SIGSEGV
Comment 2 Stan Cox 2017-10-04 14:02:46 UTC
(https://github.com/dyninst/dyninst/issues/396)
Comment 3 Stan Cox 2017-11-03 18:53:26 UTC
Fixed in dyninst-9.3.2-7
Add linux-vdso64.so.1 to blackout list in addrtranslate-sysv.C