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

Add MachOFile::parse_at_offset #304

Merged
merged 1 commit into from
May 18, 2021
Merged

Conversation

mstange
Copy link
Contributor

@mstange mstange commented May 18, 2021

This allows parsing Mach-O images inside dyld shared cache files (#268):
The dyld shared cache contains multiple images at different offsets; all these
images share the same address space for absolute offsets such as symoff. Due to
these absolute offsets, one cannot just parse the images by subsetting the input
slice and parsing at header offset zero.

This patch is a breaking change because it adds a header_offset argument to the
MachHeader methods load_commands and uuid, and MachHeader is part of the public API.

@mstange
Copy link
Contributor Author

mstange commented May 18, 2021

It is possible that this will also allow parsing mach-o images which are mapped into a running process, inside that process's memory - if one makes a ReadRef implementation which only allows accessing mapped memory regions. But I haven't tried it, and maybe there are other offsets one needs to take into account in that use case.

src/read/macho/file.rs Outdated Show resolved Hide resolved
This allows parsing Mach-O images inside dyld shared cache files (gimli-rs#268):
The dyld shared cache contains multiple images at different offsets; all these
images share the same address space for absolute offsets such as symoff. Due to
these absolute offsets, one cannot just parse the images by subsetting the input
slice and parsing at header offset zero.

This patch is a breaking change because it adds a header_offset argument to the
MachHeader methods load_commands and uuid, and MachHeader is part of the public API.
Copy link
Contributor

@philipc philipc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@philipc philipc merged commit ba60aa4 into gimli-rs:master May 18, 2021
@mstange
Copy link
Contributor Author

mstange commented May 19, 2021

Thank you!

mcbegamerxx954 pushed a commit to mcbegamerxx954/object that referenced this pull request Jun 15, 2024
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.

None yet

2 participants