Skip to content

Mac signing: add hardened-runtime entitlements so the JVM can launch - #4

Merged
jcombs-pointblue merged 1 commit into
masterfrom
fix/mac-signing-entitlements
Oct 30, 2026
Merged

jcombs-pointblue merged 1 commit into
masterfrom
fix/mac-signing-entitlements

Conversation

@jcombs-pointblue

Copy link
Copy Markdown
Contributor

scripts/sign-and-notarize-mac.sh signed the app with --options runtime but no entitlements, so the bundled JDK 25 JVM crashed at launch (EXC_BREAKPOINT in pthread_jit_write_protect_np from JNI_CreateJavaVM). Builds still passed codesign, spctl and notarization, so the failure only showed up when the app was launched.

Changes

  • New scripts/macos/arborj.entitlements:
    • com.apple.security.cs.allow-jit: HotSpot JIT
    • com.apple.security.cs.allow-unsigned-executable-memory: HotSpot code cache
    • com.apple.security.cs.disable-library-validation: JavaFX extracts libprism_es2.dylib etc. to ~/.openjfx/cache and loads them at runtime. Without this the app fails with "No toolkit found".
  • sign-and-notarize-mac.sh: resolves the plist relative to the script and fails fast if it's missing. It passes --entitlements when signing the runtime executables, Contents/MacOS, and the outer .app. Plain dylibs and the runtime bundle stay unentitled.

Verification

  • Fresh mvn clean package -Ppackage-mac on JDK 25.0.5, then the committed script.
  • Entitlements present on Contents/MacOS/ArborJ. codesign --verify --deep --strict passes.
  • Notarized (9e58c879-78e9-4ef4-87f6-27cdfee36a78). spctl reports Notarized Developer ID.
  • Launched from the mounted stapled DMG and still running after 15s, with no crash report.
  • Adversarial review: low risk, info notes only.

Follow-up (not in this PR): disable-library-validation relaxes protection against library injection, because JavaFX loads its natives from a user-writable cache. Shipping the JavaFX natives signed inside the bundle would let library validation stay on. That's a packaging change and is tracked separately.

Hardened runtime without entitlements makes the bundled JVM crash at
launch (EXC_BREAKPOINT in pthread_jit_write_protect_np). Add
scripts/macos/arborj.entitlements (allow-jit,
allow-unsigned-executable-memory, disable-library-validation for JavaFX
natives extracted to ~/.openjfx/cache) and pass it when signing runtime
executables, the Contents/MacOS launcher and the app bundle.
@jcombs-pointblue
jcombs-pointblue merged commit 0788e81 into master Oct 30, 2026
1 check passed
@jcombs-pointblue
jcombs-pointblue deleted the fix/mac-signing-entitlements branch October 30, 2026 18:51
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.

1 participant