Skip to content
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

LibELF: Confusion between .dynstr address and offset #14857

Open
timschumi opened this issue Aug 14, 2022 · 0 comments
Open

LibELF: Confusion between .dynstr address and offset #14857

timschumi opened this issue Aug 14, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@timschumi
Copy link
Member

LibELF currently obtains the address for the dynamic string table from the STRTAB entry in the dynamic section. However, that entry lists the mapped address instead of the offset within the file. For most files, this isn't a problem, as .dynstr is allocated early enough in the file so that both values don't differ.

However, if .dynstr has a different loading address compared to the file offset (example: .dynstr is at the very end of the file; a test file for this is easily obtained by using patchelf --add-needed, as this generates a new string table at the very end of the file), we end up applying the address on top of our in-memory copy of the ELF file, which ends up reading from the wrong address.

@timschumi timschumi added the bug Something isn't working label Aug 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant