-
Notifications
You must be signed in to change notification settings - Fork 115
Description
Issue Description
PTY4J 0.13.10-1 causes crashes on Apple Silicon (ARM64) macOS when used with hardened runtime code signing. The crash occurs during JVM initialization with pthread_jit_write_protect_np and EXC_BREAKPOINT (SIGTRAP).
Environment
- macOS Version: 15.5 (24F74)
- Hardware: Apple Silicon (ARM64)
- PTY4J Version: 0.13.10-1
- Java Version: Amazon Corretto 22 ARM64
- Code Signing: Developer ID with hardened runtime
Crash Details
Error Type: EXC_BREAKPOINT (SIGTRAP) - Apple Mobile File Integrity (AMFI) fatal report type 309
Stack Trace: Crash occurs in pthread_jit_write_protect_np during Threads::create_vm() JVM initialization
Root Cause: The pty4j-unix-spawn-helper binary is incompatible with Apple Silicon W^X (Write XOR Execute) memory protection under hardened runtime
Steps to Reproduce
- Create a macOS app bundle using PTY4J 0.13.10-1
- Sign the app with Developer ID and hardened runtime entitlements
- Include these entitlements (standard for Compose Desktop apps):
<key>com.apple.security.cs.allow-jit</key> <true/> <key>com.apple.security.cs.allow-unsigned-executable-memory</key> <true/> <key>com.apple.security.cs.disable-library-validation</key> <true/>
- Launch the app on Apple Silicon macOS
- App crashes immediately with
pthread_jit_write_protect_nperror
Expected Behavior
App should launch without crashing, as it does in development mode (without hardened runtime).
Actual Behavior
Immediate crash with SIGTRAP during JVM initialization.
Workaround Found
The issue can be resolved by:
- Removing
pty4j-unix-spawn-helperbinaries from the PTY4J jar - Using only
libpty.dylib(similar to IntelliJ IDEA's approach)
This suggests the spawn helper binary is the specific component incompatible with Apple Silicon hardened runtime.
Additional Context
- Development Mode: Works perfectly with
./gradlew run(no hardened runtime) - IntelliJ IDEA: Works on Apple Silicon because it uses only
libpty.dylib, not spawn helper - PTY4J 0.12.13: Did not have this issue (no spawn helper binary)
- PTY4J 0.13.10-1: Introduced
pty4j-unix-spawn-helperwhich causes the crashes
Question
Is there a way to make pty4j-unix-spawn-helper compatible with Apple Silicon hardened runtime, or should apps exclude it and use only libpty.dylib on Apple Silicon?
This affects any Compose Desktop or JavaFX application using PTY4J that needs to be distributed through the Mac App Store or signed with Developer ID.