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

MachO::Binary::extend_section fill gap by default #1154

Conversation

DzenIsRich
Copy link
Contributor

The previous implementation extended section by strictly requested amount, possibly creating a gap in case we needed to satisfy alignment requirements.

However, information about the size of the gap is lost, and not trivial to recover. This patch changes extend_section to extend section by more than requested to avoid creating the gap.

romainthomas and others added 3 commits January 5, 2025 17:45
As demonstrated by @lebr0nli in the sample `ELF/issue_dynamic_table.elf`,
the PT_DYNAMIC segment can have an "invalid" offset while still running
correctly.
This commit changes the logic of the dynamic table processing by using
the PT_LOAD segment that wraps this table
The previous implementation extended section by strictly requested
amount, possibly creating a gap in case we needed to satisfy alignment
requirements.

However, information about the size of the gap is lost, and not trivial
to recover. This patch changes `extend_section` to extend section by
more than requested to avoid creating the gap.
@romainthomas
Copy link
Member

Merged through: 9a4f609

@DzenIsRich DzenIsRich deleted the zmpr-macho-extend-section-fill-gap branch January 13, 2025 08:22
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