-
-
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
do not rely on section info when DT_DYNAMIC is available #12732
Comments
Hi could you indicate where i should look in the code if i want override this behavior with a lookup on the DT_DYNAMIC segment. |
@08a Hi, I would start from |
@ret2libc There is in libr/bin/format/elf/elf.c an interesting function init_dynamic_section. I was wondering if i could modify this function and the struct ELFOBJ? I could add DT_RELA, DT_REL, .. |
I move here the list of possible refacto:
|
I am trying to remove the |
I have no idea what |
AFAIS that is the position of the reloc entry in the relocations. IIRC ppc has some kind of relocation types that compute the final address based on the position of the relocation entry (or something like that, I don't remember exactly sorry). |
I am not sure what the function get_import_addr is doing, do you have any idea? |
Its documented in C
… On 9 Apr 2020, at 20:10, Alexis Ehret ***@***.***> wrote:
I am not sure what the function get_import_addr is doing, do you have any idea?
And maybe some documentation.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
This part of the code base is a real spaghetti code without any context it take me 3 hour to understand that it was the addr inside the plt. I am rewriting this part and i was wandering how to get the base addr of the got.
Deref the ptr
Do some magic
But i can't read the got with |
Hi @08a . Why are you rewriting that part of the code? Why do you need new logic to compute the addresses when there is already one? By the way, about using sections vs segments, I think that function is partially wrong as well as it relies on sections by name, instead of using the dynamic entries. |
I was refactoring the rel_cache_new and i discover this function that was like you said wrong because it relies on sections by name. |
My only problem right now is get the value in the got. |
@08a I think existing code is already doing that, so I suggest that you adapt the code but you change as little as possible. For example, I think you can find the code in |
i don't have the same result than the example but i am pretty sure my result is valid, it is the only arm test that fail.
I can find addresses that the previous implementation couldn't find (it was based on section name) Can i have your opinion about this. |
|
@ret2libc Hi, i was starting a small refacto, the idea was limiting the usage of Some entrie like The only problem is that the definition of
So i was wandering what you prefer? Last option forget the problem and switch to another task |
i'd say this one. |
r2r broken test: https://github.com/radare/radare2-regressions/commit/19ccc45154ca69041b8432147197738a453419e5
ELF parser should not rely on sections to compute relocations because they are not used by the loader. The loader uses the info provided in the DT_DYNAMIC segment.
The text was updated successfully, but these errors were encountered: