Hi, all,


OpenResty core tests crash with "bad light userdata pointer" on ARM64 with 48-bit kernel. We proposed a workaround to fix it in LuaJIT, but LuaJIT upstream suggests fix this issue in application rather than on LuaJIT itself. Below is the suggestion from LuaJIT upstream on how we should change the applications.


Have a look what they did to change the (few) libraries that didn't play nicely:

  • lightuserdata used as a unique table key, e.g. for the registry: with lua_pushlightuserdata(L, &x) and x on the C stack, replace x with a static variable.
  • lightuserdata used as some kind of cross-object pointer: don't do that -- it doesn't play nicely with the GC, anyway. Replace with proper userdata references.
  • lightuserdata used as a misguided userdata replacement, possibly even setting the lightuserdatametatable (ugh): throw away any such library, replace with a proper FFI binding.


Do you think the suggestion can nicely work for LuaJIT applications? If not, do you have any cases which can strongly support your argument?


Since currently, upstream is aware of this issue. I think it is the right time to raise your concerns directly on the above GitHub pull request.


--
Best regards,
Zhongwei