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

Dynamic Link Walking (Linux only) #104

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Ex-32
Copy link
Collaborator

@Ex-32 Ex-32 commented Feb 19, 2025

Dynamic Link Walking

parsing ELF files, reading environment variables, and traversing the filesystem to produce a runtime link dependency tree before an executable is exec-ed

Approximate roadmap

  • ELF parsing
    • 64-bit
      • section table parsing
      • dynamic section parsing
      • dynamic string table parsing
      • program segment table parsing
      • interpreter segment parsing
    • 32-bit
      • section table parsing
      • dynamic section parsing
      • dynamic string table parsing
      • program segment table parsing
      • interpreter segment parsing
  • dependency searching
    • environment variable aggregation
    • RPATH and RUNPATH aggregation
    • RPATH and RUNPATH substitutions
    • filesystem traversal
  • recursive evaluation
    • propagate RPATH
  • cry about added overhead

@Ex-32 Ex-32 self-assigned this Feb 19, 2025
@Ex-32 Ex-32 changed the title Dynamic Link Walking **(Linux only)** Dynamic Link Walking (Linux only) Feb 19, 2025
@charmoniumQ
Copy link
Owner

This seems reasonable; hopefully the 64-bit logic is not too different than the 32-bit.

Regarding overhead, hopefully it's not too bad, since the loader will now have a warmed cache (we aren't loading anything they wouldn't). Also, I am hoping to use statistics to separate the cost-per-exec vs cost-per-other-things.

@Ex-32
Copy link
Collaborator Author

Ex-32 commented Feb 22, 2025

hopefully the 64-bit logic is not too different than the 32-bit.

It shouldn't be: the structs and alignments are all different, but the fields are almost all the same, so like 90% of the work will probably be copy, paste, s/64/32/g

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