Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FrameworkTests fails to detour rand() on MacOS x64 due to an invalid argument error in vm_map #158

Open
nike4613 opened this issue Jan 3, 2024 · 0 comments
Assignees
Labels

Comments

@nike4613
Copy link
Contributor

nike4613 commented Jan 3, 2024

What's especially odd about this is that MonoMod code hasn't changed, and I don't think I've updated the MacOS system I'm testing on since it did work. The only thing different is that .NET 8 was installed. The failure occurs on all .NET versions.

[MonoMod.RuntimeDetour](1/2/2024 9:37:42 PM) Trace: Applying NativeHook of 0x00007ff809f07c92
[MonoMod.Utils](1/2/2024 9:37:42 PM) Trace: new DynamicMethod: System.Int32 SyncProxy<native->managed Get1Delegate>(MonoMod.RuntimeDetour.DetourManager+NativeDetourSyncInfo)
[MonoMod.Utils](1/2/2024 9:37:42 PM) Trace: mdef: System.Int32 SyncProxy<native->managed Get1Delegate>(MonoMod.RuntimeDetour.DetourManager/NativeDetourSyncInfo)
[MonoMod.Core](1/2/2024 9:37:42 PM) Trace: Applying native detour from 00007ff809f07c92 to 000000010af631a4
[MonoMod.Core](1/2/2024 9:37:42 PM) Trace: Creating simple detour 0x00007ff809f07c92 => 0x000000010af631a4
[MonoMod.Core](1/2/2024 9:37:43 PM) Trace: Performing page remap on 0x00007ff809d0a000+0x1fa50000 from r-x/r-x to rwx
[MonoMod.Core](1/2/2024 9:37:43 PM) Error: vm_map() failed to map over target range: 0x00007ff809d0a000+0x1fa50000 (r-x/r-x) <- (obj 11523) 0x00000001a4b35000+0x1fa50000 (rwx/rwx), kr = 4
Unhandled exception. System.NotSupportedException: vm_map() failed
   at MonoMod.Core.Platforms.Systems.MacOSSystem.MakePageWritable(IntPtr addrInPage) in /Users/aaron/Documents/MonoMod/src/MonoMod.Core/Platforms/Systems/MacOSSystem.cs:line 209
   at MonoMod.Core.Platforms.Systems.MacOSSystem.PatchData(PatchTargetKind targetKind, IntPtr patchTarget, ReadOnlySpan`1 data, Span`1 backup) in /Users/aaron/Documents/MonoMod/src/MonoMod.Core/Platforms/Systems/MacOSSystem.cs:line 123
   at MonoMod.Core.Platforms.PlatformTriple.CreateNativeDetour(IntPtr from, IntPtr to, Int32 detourMaxSize, IntPtr fromRw) in /Users/aaron/Documents/MonoMod/src/MonoMod.Core/Platforms/PlatformTriple.cs:line 427
   at MonoMod.Core.Platforms.PlatformTripleDetourFactory.NativeDetour.CreateDetour() in /Users/aaron/Documents/MonoMod/src/MonoMod.Core/Platforms/PlatformTripleDetourFactory.cs:line 395
   at MonoMod.Core.Platforms.PlatformTripleDetourFactory.DetourBase.Apply() in /Users/aaron/Documents/MonoMod/src/MonoMod.Core/Platforms/PlatformTripleDetourFactory.cs:line 101
   at MonoMod.RuntimeDetour.DetourManager.RootNativeDetourChainNode.UpdateChain(IDetourFactory factory, Delegate fallback) in /Users/aaron/Documents/MonoMod/src/MonoMod.RuntimeDetour/DetourManager.Native.cs:line 141
   at MonoMod.RuntimeDetour.DetourManager.NativeDetourState.UpdateChain(IDetourFactory updatingFactory) in /Users/aaron/Documents/MonoMod/src/MonoMod.RuntimeDetour/DetourManager.Native.cs:line 352
   at MonoMod.RuntimeDetour.DetourManager.NativeDetourState.AddDetour(SingleNativeDetourState detour, Boolean takeLock) in /Users/aaron/Documents/MonoMod/src/MonoMod.RuntimeDetour/DetourManager.Native.cs:line 257
   at MonoMod.RuntimeDetour.NativeHook.Apply() in /Users/aaron/Documents/MonoMod/src/MonoMod.RuntimeDetour/NativeHook.cs:line 137
   at MonoMod.RuntimeDetour.NativeHook..ctor(IntPtr function, Delegate hook, IDetourFactory factory, DetourConfig config, Boolean applyByDefault) in /Users/aaron/Documents/MonoMod/src/MonoMod.RuntimeDetour/NativeHook.cs:line 95
   at Program.<Main>$(String[] args) in /Users/aaron/Documents/MonoMod/src/MonoMod.FrameworkTests/Program.cs:line 13
fish: Job 1, 'MONOMOD_LogToFile=- dotnet exec…' terminated by signal SIGABRT (Abort)
@nike4613 nike4613 added the bug label Jan 3, 2024
@nike4613 nike4613 self-assigned this Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant