[ARM64] Execution of daemon failing, possible deprecated usage of lua_pushlightuserdata
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
Breakpoint 1, 0x0000ffffb7daa3d8 in lua_pushlightuserdata () from /usr/lib/libluajit-5.1.so.2
(gdb) bt
#0 0x0000ffffb7daa3d8 in lua_pushlightuserdata () from /usr/lib/libluajit-5.1.so.2
#1 0x0000aaaaaaab57bc in init_state (engine=0xfffffffff150) at daemon/engine.c:618
#2 engine_init (engine=0xfffffffff150, pool=0xffffffffed60) at daemon/engine.c:646
#3 0x0000aaaaaaab22c4 in main (argc=<optimized out>, argv=<optimized out>) at daemon/main.c:585
(gdb) continue
Continuing.
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
[Inferior 1 (process 18841) exited with code 01]
(gdb) frame 1
#1 0x0000aaaaaaab57bc in init_state (engine=0xfffffffff150) at daemon/engine.c:618
618 lua_pushlightuserdata(engine->L, engine);
Im not sure what exactly is going on here, but i found multiple reports related to arm64.
The recommended fix is:
LuaJIT on 64 bit systems provides a limited range of 47 bits for the legacy lightuserdata data type. This is only relevant on x64 systems which use the negative part of the virtual address space in user mode, e.g. Solaris/x64, and on ARM64 systems configured with a 48 bit or 52 bit VA. Avoid using lightuserdata to hold pointers that may point outside of that range, e.g. variables on the stack. In general, avoid this data type for new code and replace it with (much more performant) FFI bindings. FFI cdata pointers can address the full 64 bit range.
Relevant sources:
https://github.com/LuaJIT/LuaJIT/pull/230#issuecomment-260205661 https://github.com/LuaJIT/LuaJIT/blob/v2.1/doc/status.html
Kind regards MartB