HexHive / retrowrite

RetroWrite -- Retrofitting compiler passes through binary rewriting
Other
655 stars 78 forks source link

AssertionError in rw.py #3

Closed andreafioraldi closed 2 years ago

andreafioraldi commented 4 years ago

Hi, I'm trying to instrument objdump (2.32.51 from git) with basan. The binary if PIE not stripped:

objdump: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=71d653b38898745c40f2b7e2346b978da2421e41, with debug_info, not stripped

Running asantool I get the following error:

$ python -m rwtools.asan.asantool objdump objdump_basan
[*] Relocations for a section that's not loaded: .rela.dyn
[*] Relocations for a section that's not loaded: .rela.plt
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/andrea/Documents/retrowrite/rwtools/asan/asantool.py", line 83, in <module>
    rewriter = do_symbolization(args.binary, args.outfile)
  File "/home/andrea/Documents/retrowrite/rwtools/asan/asantool.py", line 30, in do_symbolization
    rw.symbolize()
  File "/home/andrea/Documents/retrowrite/librw/rw.py", line 57, in symbolize
    symb.symbolize_text_section(self.container, None)
  File "/home/andrea/Documents/retrowrite/librw/rw.py", line 144, in symbolize_text_section
    self.symbolize_mem_accesses(container, context)
  File "/home/andrea/Documents/retrowrite/librw/rw.py", line 331, in symbolize_mem_accesses
    container, target)
  File "/home/andrea/Documents/retrowrite/librw/rw.py", line 265, in _adjust_target
    assert sec is not None
AssertionError

I'm on Ubuntu 18.04.2 , I've just run setup.sh to prepare the retrowrite venv. My python version is:

Python 3.6.8 (default, Jan 14 2019, 11:02:34) 
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux

I attach the objdump binary. objdump.zip

sushant94 commented 4 years ago

Thanks for the report and binary, I'll check it out.

diagprov commented 2 years ago

This may be another testcase related to #30. I'm going to close this issue, but we will track fixes to this problem there.