You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
.jinit() fails on Apple silicon with hardened run-time #267
On my local Mac mini the error I get is as follows
library(rJava)
.jinit()
zsh: trace trap R
So the R session crashes entirely. I have tried with different versions of JDK (the Azul Zulu Builds), but the Java version does not make a difference.
Looking inside .jinit(), I can reconstruct this scenario for the R crash:
trap usually means you are permission violation, i.e. the Apple security protection doesn't allow the action. Java uses JIT (just-in-time compiler) which modifies executable code in memory which is potentially unsafe action since exploits use this to modify valid code into malicious code. That's why by default the hardened run-times which are required for notarization of applications by Apple don't allow this modification. Hence macOS will kill process that tries to do that.
One way out is to not use hardened R run-time which is described in the FAQ above. Obviously it is less secure, but your only option at this point. For the next release of R we will consider a modification of the hardened run-time entitlements to allow JIT modifications if permitted by Apple., but it's not something you can do yourself nor can it be changed retrospectively.
It appears that adding com.apple.security.cs.allow-jit=true to R entitlements does the trick. So you can use R-4.1.1-patched (or higher) from http://mac.R-project.org
Activity
s-u commentedon Sep 2, 2021
TL;DR: instead of released R, use non-hardened R runtime from https://mac.R-project.org (same reason as https://mac.r-project.org/bin/macosx/RMacOSX-FAQ.html#I-cannot-attach-debugger-to-R )
trapusually means you are permission violation, i.e. the Apple security protection doesn't allow the action. Java uses JIT (just-in-time compiler) which modifies executable code in memory which is potentially unsafe action since exploits use this to modify valid code into malicious code. That's why by default the hardened run-times which are required for notarization of applications by Apple don't allow this modification. Hence macOS will kill process that tries to do that.One way out is to not use hardened R run-time which is described in the FAQ above. Obviously it is less secure, but your only option at this point. For the next release of R we will consider a modification of the hardened run-time entitlements to allow JIT modifications if permitted by Apple., but it's not something you can do yourself nor can it be changed retrospectively.
[-].jinit() fails on Apple silicon[/-][+].jinit() fails on Apple silicon with hardened run-time[/+]s-u commentedon Sep 2, 2021
It appears that adding
com.apple.security.cs.allow-jit=trueto R entitlements does the trick. So you can use R-4.1.1-patched (or higher) from http://mac.R-project.org