How to redirect the dynamic linked libraries?

42 views
Skip to first unread message

moonlight

unread,
Jul 23, 2023, 8:30:42 AM7/23/23
to DynamoRIO Users
Hi, 
I utilize the instrace_simple.so of dynamorio to trace the instruction of a simple program a.out. 
When executing `ldd a.out`
The a.out is dynamic linked with:
linux-vdso.so.1 =>  (0x00007ffff7ffa000)
libc.so.6 => /lib64/libc.so.6 (0x00007ffff7a0d000)
/lib64/ld-linux-x86-64.so.2 (0x00007ffff7ddb000)
However, when I utilize the instrace_simple.so to trace the program with:
./bin64/drrun -late -c ./api/bin/libinstrace_simple.so -- ../../testcase/a.out
I dump the full_path of each module:
Binary /home/testcase/a.out Entry Point: 0x0000000000400000, 0x0000000000401060, 0x0000000000405000
Binary /home/dynamorio/build/lib64/release/libdynamorio.so Entry Point: 0x0000000071000000, 0x0000000071110251, 0x0000000071220000
Binary /home/dynamorio/build/api/bin/libinstrace_simple.so Entry Point: 0x0000000072000000, 0x0000000072002490, 0x0000000072007000
Binary /usr/lib64/libc-2.17.so Entry Point: 0x00007ffff7a0d000, 0x00007ffff7a2f660, 0x00007ffff7ddb000
Binary /usr/lib64/ld-2.17.so Entry Point: 0x00007ffff7ddb000, 0x00007ffff7ddc140, 0x00007ffff7fff000
Binary /home/dynamorio/build/lib64/release/libdrpreload.so Entry Point: 0x00007ffff7fe6000, 0x00007ffff7fe7080, 0x00007ffff7ff8000
Binary [vdso] Entry Point: 0x00007ffff7ffa000, 0x00007ffff7ffa600, 0x00007ffff7ffc000

The a.out running under dynamorio is relinked with /usr/lib64/libc-2.17.so rather than the /lib64/libc.so.6.
The LD_LIBRARY_PATH is set as:
LD_LIBRARY_PATH=/lib64:/opt/rh/devtoolset-9/root/usr/lib64:/opt/rh/devtoolset-9/root/usr/lib:/opt/rh/devtoolset-9/root/usr/lib64/dyninst:/opt/rh/devtoolset-9/root/usr/lib/dyninst:/opt/rh/devtoolset-9/root/usr/lib64:/opt/rh/devtoolset-9/root/usr/lib

How can I relink a.out with /lib64/libc.so.6 under the dynamorio?
I'm looking forward to your help.

Abhinav Sharma

unread,
Jul 24, 2023, 4:38:00 PM7/24/23
to DynamoRIO Users
Hi,
I don't think those are necessarily different files. I don't have details of those files you mentioned on your system, but can you check if one is a symbolic link to the other? Also see https://unix.stackexchange.com/questions/449107/what-differences-and-relations-are-between-the-various-libc-so.

Abhinav

Derek Bruening

unread,
Jul 24, 2023, 5:19:41 PM7/24/23
to Abhinav Sharma, DynamoRIO Users
Further thoughts:
  • Why are you using "-late"?  That old option is not very well supported and should be considered deprecated.
  • How do you know which libc you printed out?  Is that the private libc copy used by libinstrace.so, and the libc wanted by the app hasn't even been loaded yet?  At what point in time did you get a module snapshot?  How did you get a module snapshot?
  • What happens with no client?

--
You received this message because you are subscribed to the Google Groups "DynamoRIO Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dynamorio-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dynamorio-users/39ccb543-6f78-4923-8515-8c08ef0d6207n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages