Repository navigation
fix: write full addresses when preparing JIT pages - #5
Closed
ignaciojuarez wants to merge 1 commit into
Closed
ignaciojuarez wants to merge 1 commit into
ignaciojuarez wants to merge 1 commit into
Conversation
makeBlessCommands wrote 9 hex digits per page address, so a region above 0xFFFFFFFFF (64 GB) lost its top digit. Apps with extended virtual addressing can get JIT regions there; the wrong pages were prepared and the first JIT instruction failed with KERN_CODESIGN_ERROR. Write all 16 digits (command length 19 -> 26). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ignaciojuarez
added a commit
to ignaciojuarez/cofre
that referenced
this pull request
Nov 1, 2026
StikJIT's batched page prepare wrote 9 hex digits per address, so with extended virtual addressing a JIT region at e.g. 0x7239f1c000 lost its top digit: the wrong pages were prepared and the JVM's first JIT call died with KERN_CODESIGN_ERROR. It was intermittent because it depends on where the region lands. - patches/stikjit/0001 writes all 16 digits (command 19 -> 26 bytes). - scripts/stikjit-sources.sh applies StikJIT patches into .work/stikjit; the tunnel target builds that copy. Sent upstream: StikDebug/StikJIT#5. - The detach test checks a high region reaches the helper intact. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
This use case doesn't apply to the majority of our users, so I am closing this. |
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.
Problem
prepare_memory_regionbuilds oneM<addr>,1:69packet per 16 KB page inmakeBlessCommands, butwriteHexAddresswrites exactly 9 hex digits. Any address above0xFFFFFFFFF(64 GB) loses its top digit.Apps signed with
com.apple.developer.kernel.extended-virtual-addressingcan get JIT regions there. Example from an iPhone 17 Pro on iOS 26 (TXM), with a JVM asking for a 64 MB code cache:0x7239f1c000(10 digits)0x239f1c000…insteadEXC_BAD_ACCESS/KERN_CODESIGN_ERROR(0x32) at RX+0xbcThe same app with the region at
0x16ea58000(9 digits) works, so the crash is intermittent and depends on where the region lands. The replies to the batched writes aren't checked, so the script still sees success.Side effect: the 0x69 bytes are written to whatever happens to be mapped at the truncated address.
Fix
Write all 16 hex digits. The command length goes from 19 to 26 bytes, and the
,1:69#and checksum offsets move with it. gdb-remote accepts any address width.Checked by compiling
makeBlessCommandson its own: two pages at0x7239f1c000produce$M0000007239f1c000,1:69#d2$M0000007239f20000,1:69#a0, with valid checksums.Possible follow-up: read and check each reply to the batched writes, so a failed write is reported instead of silently succeeding.
🤖 Generated with Claude Code