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

Implement the DT_GNU_HASH mechanism for vDSO parsing. #1259

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

sunfishcode
Copy link
Member

@sunfishcode sunfishcode commented Jan 8, 2025

Linux recently removed the DT_HASH section from the aarch64 vDSO. To continue to be able to read vDSOs, implement the DT_GNU_HASH section, following the logic in this patch.

Linux recently [removed] the `DT_HASH` section from the aarch64 vDSO. To
continue to be able to read vDSOs, implement the `DT_GNU_HASH` section,
following the logic in [this patch].

[removed]: torvalds/linux@48f6430
[this patch]: https://lkml.org/lkml/2024/12/6/828
@ids1024
Copy link
Contributor

ids1024 commented Jan 8, 2025

I wonder if vdso.rs could use less unsafe code. If the vDSO is just a region of memory that isn't mutated, it could be cast as slice (or portions of it could be; I guess ELF headers don't have a field that simply represents the size of the whole elf binary?). Something like #1253 should at least not be a segfault.

Though I guess if it mostly just matches the reference implementation in C, this would make it a bit less close.

@sunfishcode
Copy link
Member Author

@ids1024 My sense is that keeping the code close to the reference implementation is more valuable in this situation. The ELF data structures are pretty subtle, and it's easy to accidentally use them in ways that work but aren't guaranteed by the ABI. By sticking super close to the reference code, we can be more confident that we're only depending on things that matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants