qilingframework / qiling

A True Instrumentable Binary Emulation Framework
https://qiling.io
GNU General Public License v2.0
5.06k stars 737 forks source link

Linker fails to link dynamic link libraries correctly #1469

Open zhu1024 opened 4 months ago

zhu1024 commented 4 months ago

*Describe the bug When using Qiling to simulate executable file, I encountered a problem where the linker was unable to link dynamic link libraries correctly, i.e. ld-linux.so was unable to link dynamic link libraries such as libc.so. This resulted in the target program in the simulation environment not being able to find the required DLLs, and thus the simulation could not be executed successfully.

Sample Code

ql = Qiling([r'./update/os'], r'./rootfs', verbose=QL_VERBOSE.DISASM)
ql.run(end=0x15fd0)    #15fd0 is the address of the main function

Expected behavior Dynamic link libraries are all loaded successfully, qiling can be called by symbols can jump to the appropriate location.

Screenshots 图片12 pic13

Additional context The environment should be fine and there are many other executables that can be emulated successfully. There is one executable that can also be simulated successfully after removing some of the dynamic link libraries using the patchelf tool. Is there a solution for this situation?