-
-
Notifications
You must be signed in to change notification settings - Fork 286
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
hackmud fails to launch sometimes, failed assertion in Mono #131
Comments
Yes, I still don't know why some pointer are not 32bits. |
@ptitSeb If I can do anything to help you figure this out, let me know. |
I need to understand were this pointer came from. I assume it comes from a mmap or malloc or something similar, but I haven't found the source yet. |
For some reason I'm having trouble getting this to trigger from within GDB. |
Ok, yeah, after like an hour of running gdb over and over and over again, this does not happen in GDB. It still can happen if I attach GDB afterwards, but
|
Oh my, after hours of digging through mono source code, adding debug messages, and recompiling, I finally figured it why it crashes. So, the issue happens when mono's JIT tries to emulate a call to its IL's FREM opcode. #ifdef MONO_ARCH_EMULATE_FREM
register_opcode_emulation (OP_FREM, "__emul_frem", "double double double", fmod, "fmod", FALSE);
register_opcode_emulation (OP_RREM, "__emul_rrem", "float float float", fmodf, "fmodf", FALSE);
#endif So, when we run the code, we crash at a JIT'd call to __emul_frem (= fmod).
This means that we attempt to call fmod, which is located at #define amd64_is_imm32(val) ((gint64)val >= -((gint64)1<<31) && (gint64)val <= (((gint64)1<<31)-1)) If we take a look at the memory mapping of the process, this is how it looks:
A possible fix would be to make sure that box64 maps memory and mounts libraries before |
Oh, wow, well done! Do you know if there is other function called, other than |
Also, "signed i32". Damn, that's half what I was counting on. |
I have no idea, but it might be good practice to use I'll test and open a PR. |
It's not librarian here. It's the bridges, because Note that I will not be able to tests box64 in the next few days. But I should still be able to look at PR (and there is CI with travis now on box64 too) |
Oh alright, thanks for letting me know. I'll play around with the code. |
Look in |
This fixes an issue with mono where JIT compiled code would near-call wrapped libraries, but fail because the difference between PC and the call address did not fit into an imm32. This was fixed by replacing posix_memalign with my_mmap and providing the MAP_32BIT flag. Fixes ptitSeb#131
I get the same message as in #105, except I don't get any error messages about opcodes.
Here are the following links to source code on GitHub with the exact lines:
mini-amd64.c
interp-stubs.c
The text was updated successfully, but these errors were encountered: