Patch failure on macOS with Apple Silicon chip & Unity 2021.2 arm version

See original GitHub issue

Harmony can’t apply patch when running inside Unity 2021.2 arm version on Apple Silicon chip. Here is an exception stack:

Exception: mprotect returned EACCES
MonoMod.RuntimeDetour.Platforms.DetourNativeMonoPosixPlatform.SetMemPerms (System.IntPtr start, System.UInt64 len, MonoMod.RuntimeDetour.Platforms.DetourNativeMonoPosixPlatform+MmapProts prot) (at <c38a8c3281a047488dac8c9d063b7abb>:0)
MonoMod.RuntimeDetour.Platforms.DetourNativeMonoPosixPlatform.MakeWritable (System.IntPtr src, System.UInt32 size) (at <c38a8c3281a047488dac8c9d063b7abb>:0)
MonoMod.RuntimeDetour.DetourHelper.MakeWritable (MonoMod.RuntimeDetour.IDetourNativePlatform plat, MonoMod.RuntimeDetour.NativeDetourData detour) (at <c38a8c3281a047488dac8c9d063b7abb>:0)
MonoMod.RuntimeDetour.Platforms.DetourRuntimeILPlatform._HookSelftest (System.Reflection.MethodInfo from, System.Reflection.MethodInfo to) (at <c38a8c3281a047488dac8c9d063b7abb>:0)
MonoMod.RuntimeDetour.Platforms.DetourRuntimeILPlatform..ctor () (at <c38a8c3281a047488dac8c9d063b7abb>:0)
MonoMod.RuntimeDetour.Platforms.DetourRuntimeMonoPlatform..ctor () (at <c38a8c3281a047488dac8c9d063b7abb>:0)
MonoMod.RuntimeDetour.DetourHelper.get_Runtime () (at <c38a8c3281a047488dac8c9d063b7abb>:0)
HarmonyLib.HarmonySharedState.WithState[T] (System.Func`1[TResult] action) (at <c38a8c3281a047488dac8c9d063b7abb>:0)
HarmonyLib.HarmonySharedState.GetPatchInfo (System.Reflection.MethodBase method) (at <c38a8c3281a047488dac8c9d063b7abb>:0)
HarmonyLib.PatchProcessor.Patch () (at <c38a8c3281a047488dac8c9d063b7abb>:0)
HarmonyLib.Harmony.Patch (System.Reflection.MethodBase original, HarmonyLib.HarmonyMethod prefix, HarmonyLib.HarmonyMethod postfix, HarmonyLib.HarmonyMethod transpiler, HarmonyLib.HarmonyMethod finalizer) (at <c38a8c3281a047488dac8c9d063b7abb>:0)
Fiftytwo.AddressablesAnalyzeHack.InstallAddressablesAnalyzeHack () (at Assets/Scripts/Editor/AddressablesAnalyzeHack.cs:73)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
pardeikecommented, Apr 4, 2023

https://github.com/pardeike/Harmony/tree/feature/monomod-core will probably solve this when its completed.

1reaction
nike4613commented, Jun 18, 2023

https://github.com/MonoMod/MonoMod/issues/90 is probably the closest to a tracking issue we have for this. I don’t have Apple Silicon (or even really a machine with an ARM chip I can use), so architecture support is currently missing, then the MacOS System implementation needs to be modified to behave using Apple’s W^X APIs on M1.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Official - Apple silicon support through the Unity Hub
2021.2 is the first version of Unity that supports Apple silicon ... For the editor, I'm on Unity 2020 and Mac builds for...
Read more >
Apple Silicon (M1 chip) Support in Rider
Alexander Kurakin I got an error when download the update and I saw the release note which I think is release note for...
Read more >
Manual: Build a macOS application
Handling purchase failures ... Intel 64-bit + Apple silicon, Use Intel 64-bit + Apple silicon to generate a macOS build that works on...
Read more >
Is the Apple Silicon version of Unity faster? And by how much?
In this video I test the Apple Silicon version against the x64 ... #m1 # unity #applesilicon Related videos: ▶️ M1 MacBook vs...
Read more >
Problems with Unity 2021.3.1f1 (Silicon)
I have a project in Unity that is crashing during the Asset import, but only when I try to use a particular SDK....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found