MachO: adjust __init_offsets when add_section shifts __TEXT - #1368
Closed
je-empty wants to merge 1 commit into
Closed
MachO: adjust __init_offsets when add_section shifts __TEXT#1368je-empty wants to merge 1 commit into
je-empty wants to merge 1 commit into
Conversation
je-empty
force-pushed
the
fix/macho-init-offsets-shift
branch
from
August 6, 2026 16:57
b7b747e to
9c322e9
Compare
je-empty
force-pushed
the
fix/macho-init-offsets-shift
branch
3 times, most recently
from
August 6, 2026 17:08
afa6327 to
14973dc
Compare
je-empty
force-pushed
the
fix/macho-init-offsets-shift
branch
from
August 6, 2026 17:10
14973dc to
d183861
Compare
Author
|
Superseded by #1369 — same fix, clean single-commit history. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
add_sectioninto__TEXTshifts the following content viaBinary::shift, butshiftdoesn't update the image-base offsets stored in__TEXT,__init_offsets(S_INIT_FUNC_OFFSETS). They keep pointing at the old location, so dyld jumps into the wrong place and the binary crashes at launch (SIGILL). The fix bumps each entry past the shift point.The constructor offset stays
0x4b0while the code moves to0x44b0; a section too small to force a shift is unaffected. Verified on macOS arm64 and an iPhone Air (iOS 26.6). Closes #1229.