Closed L1pE closed 3 years ago
Very cool if this works. I'll check this out at some point.
Any news on this?
Nothing yet. I'll update the issue once there is.
I was able to stop the crashing (from what I tested) by recompiling the Pi model (https://github.com/zm-reborn/zmr-assets/commit/30849a8a12fb2ccaab4076f81ffcc0994faaa507).
I'm hesitant to start fixing this issue by patching binaries, especially when the cause is a bad decompile. I vividly remember having a similar issue on Windows with the Lawyer model, and that model doesn't have any of those flex definitions that Pi had.
After discussing these crashes with Cthulhu, he has provided me a hex-editted studiorender.so to test a solution, which worked, fixed #315 and others. He has explained the instruction causing the crash (movntps) requires an aligned memory block (16-bytes aligned in this case). He then proposed the following fix to be implemented in the code of the mod:
Define the offsets in one of the headers
Add the following in a function
Then call, after loading studiorender.so and only once
This is extensible if there's still other crashes left in other addresses, you must load the coredump (or converted minidump file) in GDB, find the address of the crash, subtract it by the base address of the .so, then run
x/i5 $pc
and put all the movntps offsets on the array above, since movntps and movups share the same first byte within their instruction opcodes as well as the number and type of operands, only the address of the second byte is changed, from 0x2B to 0x11 (he explained), the loop will automatically apply the patch.EDIT: code improvements.