Hi!
We are observing crashes; it appears as if several lua_States are
unintentionally sharing
stacks and they are changing values from under each other. We are doing
our own C stack switching (‘fibers’).
Apparently LuaJIT tracks the currently executing Lua state in the global_State.
I wonder if the
way we are using LuaJIT is 100% legal, however it looks like LuaJIT anticipates
this kind of usage.
For instance, BC_FUNCC restores cur_L just in case after a lua-C function
returns.
The exceptional code path, namely vm_unwind_c_eh and vm_unwind_ff_eh, don’t
come with
this kind of a safety net. After we added cur_L restoration in eh handlers,
crashes stopped.
It would be great if the patch is accepted. I’ve done only x86/x64.
Regards,
Nick
Attachment:
eh_cur_L.patch
Description: Binary data