-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to find string xrefs for shared libraries #6283
Comments
Here is the lib - libtest.zip |
Because of the relocs?
… On 4 Dec 2016, at 23:27, Maijin ***@***.***> wrote:
Here is the lib - libtest.zip
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Anyone tested this yet? A good issue actually. |
so looks like this compiler generates "call next;next:;pop eax" and then computes the relative pointer to the string from here. you can fix this with the string itself is not recognized because it priorizes the section symbol in here. we can do better here with the new apis i added that are used in the disasm |
I think we should allow asmemu to emulate part of the stack without requiring asm.emuwrite. That would be the best way to handle all those cases because compilers can get really funky here and identifying patterns to resolve references seems like a bad idea to me
… On 12 Dec 2016, at 01:21, Edoardo Morandi ***@***.***> wrote:
This is very nice. However I am still having some troubles. This file contains a compiled lib from the source I posted.
I am not able to obtain the same results with this library, even if everything seems to work flawlessly with the one given by @Maijin.
Here it is what I get using this lib:
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
thats the same, but calling a helper function to set eax=ret address
what about other archs? is this also an issue for arm or mips?
… On 12 Dec 2016, at 01:21, Edoardo Morandi ***@***.***> wrote:
This is very nice. However I am still having some troubles. This file <https://drive.google.com/file/d/0B88Q0Bv2HTxxSW9jWUQtNEZpd2c/view?usp=sharing> contains a compiled lib from the source I posted.
I am not able to obtain the same results with this library, even if everything seems to work flawlessly with the one given by @Maijin <https://github.com/Maijin>.
Here it is what I get using this lib:
<https://cloud.githubusercontent.com/assets/350168/21084773/e16405ae-c008-11e6-860b-380db0a85bfc.png>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#6283 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AA3-lsLKLfL0kqXSd0vVEf-69IIEakXcks5rHJOmgaJpZM4LDuDB>.
|
I am able to cross-compile for ARM, and things seem to work correctly. asm.emuwrite does not seem to be necessary, but I just tried to compile against armv7-a. Unfortunately I do not have a gcc binary to compile against MIPS. Anyone can do this? Otherwise I will leave my laptop compile the mips64-elf-gcc overnight. |
you can use the ndk.. well i could do this too but im a bit busy. just trying to get feedback and ideas for different problems that may affect this issue. thanks!
… On 12 Dec 2016, at 14:29, Edoardo Morandi ***@***.***> wrote:
I am able to cross-compile for ARM, and things seem to work correctly. asm.emuwrite does not seem to be necessary, but I just tried to compile against armv7-a.
Unfortunately I do not have a gcc binary to compile against MIPS. Anyone can do this? Otherwise I will leave my laptop compile the mips64-elf-gcc overnight.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#6283 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AA3-ls8AibD4Rf2RDL6FrFiyhZOYmOqJks5rHUw6gaJpZM4LDuDB>.
|
without aeim i dont think the emulation of mips will work at all also asm.emuwrite is needed
… On 13 Dec 2016, at 12:34, Edoardo Morandi ***@***.***> wrote:
I performed some tests, and I am not completely sure of the results I get:
<https://cloud.githubusercontent.com/assets/350168/21138308/b80b6c1c-c12d-11e6-82c1-7286d897ae8f.png>
This is what I get if I compile the test lib with the ndk prebuilts. Specifically, the file has been built with the mipsel-linux-android-gcc 4.9.x (20150123), using arch mips32r6.
It is my very first time I see a MIPS assembly, and it is almost obscure to me. However I can see that the str.Hello_World_ ref is seen used in the addition operation (but not sure if it is easy to detect that it will be passed to sym.imp.puts -- probably related to my ignorance ;-) ).
I also tried to use the x86 gcc compiler from ndk, and the issue seems to persist even with this old gcc version.
<https://cloud.githubusercontent.com/assets/350168/21138829/3177d4a8-c130-11e6-8b8d-80699bced315.png>
If you thing I can perform some other test, just let me know. I am happy if I am able to help you with this problem!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#6283 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AA3-luyDfHEFw2KfeT8JCkYnmH7-mhjKks5rHoLPgaJpZM4LDuDB>.
|
Whoops, sorry! |
the string ref is fine in mips sorry :D
… On 13 Dec 2016, at 12:37, ***@***.*** wrote:
without aeim i dont think the emulation of mips will work at all also asm.emuwrite is needed
> On 13 Dec 2016, at 12:34, Edoardo Morandi ***@***.*** ***@***.***>> wrote:
>
> I performed some tests, and I am not completely sure of the results I get:
> <https://cloud.githubusercontent.com/assets/350168/21138308/b80b6c1c-c12d-11e6-82c1-7286d897ae8f.png>
> This is what I get if I compile the test lib with the ndk prebuilts. Specifically, the file has been built with the mipsel-linux-android-gcc 4.9.x (20150123), using arch mips32r6.
> It is my very first time I see a MIPS assembly, and it is almost obscure to me. However I can see that the str.Hello_World_ ref is seen used in the addition operation (but not sure if it is easy to detect that it will be passed to sym.imp.puts -- probably related to my ignorance ;-) ).
>
> I also tried to use the x86 gcc compiler from ndk, and the issue seems to persist even with this old gcc version.
> <https://cloud.githubusercontent.com/assets/350168/21138829/3177d4a8-c130-11e6-8b8d-80699bced315.png>
> If you thing I can perform some other test, just let me know. I am happy if I am able to help you with this problem!
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub <#6283 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AA3-luyDfHEFw2KfeT8JCkYnmH7-mhjKks5rHoLPgaJpZM4LDuDB>.
>
|
related pr adding aaef to aaa fixing the missing string ref breaks the type analysis #22825 will look carefully again when i have time |
its possible to fix r2dec by patching the instruction, but only using meta or anal hints should be enough imho so i want to look into that too |
Short version of this bug: take a shared library not compiled for x86_64 and radare2 is unable to find references to strings.
Long version:
Take this piece of c code:
Name the file as test.c and compile it as following:
gcc -shared -fPIC test.c -o libtest.so
Then open with radare:
Fine! But now try with:
gcc -shared -fPIC test.c -m32 -o libtest.so
What we got is:
As you can see, the string reference is not found.
r2 -v
radare2 1.1.0-git 13141 @ linux-x86-64 git.1.0.2-197-g0251197
commit: 0251197 build: 2016-12-02
The text was updated successfully, but these errors were encountered: