fix(recipes/v1_0_2): relocate CAVE_REGION out of __eh_frame#40
Open
tkgstrator wants to merge 3 commits into
Open
fix(recipes/v1_0_2): relocate CAVE_REGION out of __eh_frame#40tkgstrator wants to merge 3 commits into
tkgstrator wants to merge 3 commits into
Conversation
1.0.2's __TEXT,__eh_frame grew to 0x81ACE58..0x826F5E8, fully covering the inherited 1.0.1 CAVE_REGION (0x826A000..0x826C000). Writing caves there clobbered DWARF CFI bytes and verify_patches refused every site with 'cave was not zero-fill nor the matching payload'. Move CAVE_REGION to the verified-zero tail after __oslogstring at 0x8270040..0x8272040 (8 KB; UnityFramework section tail). lief-verified all-zero; B reach from the farthest site (0x6082AC0) is well within the +/-128 MB AArch64 limit. Verified end-to-end: make ipa TARGET_VERSION=1.0.2 now succeeds and produces Kiou-1.0.2-patched.ipa. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adjusts the 1.0.2 recipe’s code-cave allocation region to avoid writing into __TEXT,__eh_frame, preventing patch-time verification failures/crashes when building the patched 1.0.2 IPA.
Changes:
- Relocates
CAVE_REGIONforrecipes/v1_0_2.pyto a verified-zero area outside__eh_frame. - Adds inline rationale documenting why the 1.0.1 cave region is invalid for 1.0.2.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+12
to
+16
| # 1.0.1's CAVE_REGION at 0x826A000 was a __TEXT zero-fill area, but in 1.0.2 | ||
| # __TEXT,__eh_frame grew to 0x81ACE58..0x826F5E8 and now covers that range — | ||
| # writing caves there corrupts DWARF CFI. Relocate to the verified-zero tail | ||
| # after __oslogstring (0x8270023..0x8274000); 8 KB is plenty for 37 caves. | ||
| CAVE_REGION = (0x8270040, 0x8272040) |
ENTRY_SLOT_BASE_RVA (0x091E91B8) inherited from 1.0.1 lands in __DATA,__common in 1.0.2 — that section is pre-initialised, so the recipe's 32-slot block is non-zero on disk. At runtime an entry cave's BLR through the slot loads that garbage as a function pointer and crashes (Login, AccountExists, ...). Relocate to the verified-zero tail of __DATA,__bss at 0x8F9D3B8 (0x100 = 32 slots * 8 B, fits ahead of PROBED_HOOK_SLOT_RVA). bss is guaranteed zero on launch, so cave -> BLR through an unpublished slot is harmless until the dylib publishes the hook fn ptr. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
make ipa TARGET_VERSION=1.0.2crashed with 37cave was not zero-fill nor the matching payloaderrors. Root cause:recipes/v1_0_2.pyinherited 1.0.1'sCAVE_REGION = (0x826A000, 0x826C000), but 1.0.2's UnityFramework__TEXT,__eh_framegrew to0x81ACE58..0x826F5E8and now fully covers that range. The DWARF CFI bytes there (0x44 0x0e 0x40 ...=DW_CFA_advance_loc | DW_CFA_def_cfa_offset) triggered the verify-before-write guard.Relocate
CAVE_REGIONto0x8270040..0x8272040— the verified-zero tail after__oslogstring. 8 KB is plenty for 37 caves. lief confirmed all bytes are zero;Breach from the farthest site (0x6082AC0 → 0x8270040 ≈ 35 MB) is well within AArch64±128 MB.Test plan
make ipa TARGET_VERSION=1.0.2now completes end-to-end and producespackages/ipa/Kiou-1.0.2-patched.ipa. CI builds the three flavours.🤖 Generated with Claude Code