Re: SEGV in in lua_resume after lua_yield from hook.

  • From: Mike Pall <mikelj-2203@xxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 31 Mar 2022 17:17:49 +0200

Theo Schlossnagle wrote:

I have a (rather large) luajit runtime (on x86_64) and we implement
preempting by using timers on Linux to singal and lua_sethook with a count
of 1.

Since XmiliaH tried for a repro (thanks!) in
  https://github.com/LuaJIT/LuaJIT/issues/824
and was unaware of the precise restrictions for lua_sethook(),
I'll leave this here as well:

  lua_sethook() (only when SETTING a count hook) is signal-safe, but NOT 
thread-safe.

Your description sounds like you're aware of that. But please
double-check that the signal handler is called on the exact same
thread which is currently executing Lua code.

--Mike

Other related posts: