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
Last entry in .data section content is not updated to new offset when segment is added #418
Comments
I think I understand the issue but the modification seems not generic ? Also, did you check the relocations ? |
I did check the relocation sections, but I will check again. I’m rephrasing what I have seen in case my first attempt lacked clarity: Update: the test passed after manually updating .data’s EPFD[8] to the new virtual address. |
Dynamic relocations look fine - no symbols are associated with the RELATIVE relocation entry, but this relocation entry's address and EPFD symbol value are equivalent. But the issue are the relative pointers in the EPFD array - both EPFD and STATUS are const char* of size 9 => 36 bytes associated with each symbol. Here's the .rodata section from the original binary ./AIS-Lite, x, and the binary with LIEF inserted segment ./added_seg.bin, y:
Here's some information for EPFD and STATUS symbols from the original ./AIS-Lite binary:
Here is the same information from the ./added_seg.bin:
Since all STATUS elements [pointers to .rodata] have been updated to the new .rodata offset, perhaps it has more to do with the last element of the array EPFD is the last valid memory location in the section?
|
I was able to generate a VERY simple scenario that duplicates this bug. contents of test_418.c
COMPILE: lief manipulation:
output of "./lief_test_418": I cannot duplicate this error with a 64b ELF binary input: |
@romainthomas - I hope that this is good enough for you to root cause! |
addresses boundary scenario for relocations whose relative offsets abut segment_size
addresses boundary scenario for relocations whose relative offsets abut segment_size
addresses boundary scenario for relocations whose relative offsets abut segment_size
Describe the bug
Content of .data section, when last 64 bytes is an .rodata address, is not updated when a new segment is added.
To Reproduce
I do not have a simple input binary that demonstrates this issue, but :
These addresses correspond to the .rodata offsets
0x41b2
and0x4134
in the original binary.In the ./added_seg.bin, the corresponding .rodata offsets for these symbols are
0x51b2
and0x5134
, but in the actual .data contents of ./added_seg.bin are0x51b2
and0x4134
, respectively. Symbols are fine, just the last .data content has not been updated to the new offset.I'm not sure if this information is relevant, but the problematic global symbol is a const array of char*.
Expected behavior
I'm expecting that if some .data content is updated to the new offset, then all content is updated.
That means this:
should be:
Environment (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: