[Tarantool-patches] [PATCH luajit 2/2] jit: abort trace execution on JIT mode change

Igor Munkin imun at tarantool.org
Sun Mar 29 13:46:14 MSK 2020


Sergos,

Thanks for you review!

On 28.03.20, Sergey Ostanevich wrote:
> Hi!
> 
> Thanks for the patch, LGTM.
> 
> Sergos.
> 
> On 27 мар 13:47, Igor Munkin wrote:
> > Current luaJIT_setmode implementation aborts trace recording but nothing
> > prevents calling it on already compiled trace. E.g. if one conditionally
> > calls an FFI function having luaJIT_setmode with LUAJIT_MODE_FLUSH mode
> > underneath, the trace being executed can be purged and the return
> > address is invalidated as a result (since the mcode is released).
> > 
> > This changeset prohibits luaJIT_setmode call while mcode is being
> > executed leading to platform panic if the call occurs.

I reworded this section considering your comment about platform panic:

================================================================================

This changeset prohibits luaJIT_setmode call while mcode is being
executed. If the call occurs the platform finishes its execution with
EXIT_FAILURE code and calls panic routine prior to the exit.

================================================================================

> > 

Reviewed-by: Sergey Ostanevich <sergos at tarantool.org>

> > Signed-off-by: Igor Munkin <imun at tarantool.org>
> > ---
> >  src/lj_dispatch.c                     |  5 +++++
> >  src/lj_errmsg.h                       |  1 +
> >  test/lj-flush-on-trace/CMakeLists.txt |  1 +
> >  test/lj-flush-on-trace/libflush.c     | 31 +++++++++++++++++++++++++++
> >  test/lj-flush-on-trace/test.lua       | 25 +++++++++++++++++++++
> >  5 files changed, 63 insertions(+)
> >  create mode 100644 test/lj-flush-on-trace/CMakeLists.txt
> >  create mode 100644 test/lj-flush-on-trace/libflush.c
> >  create mode 100644 test/lj-flush-on-trace/test.lua
> > 

<snipped>

> > -- 
> > 2.25.0
> > 

-- 
Best regards,
IM


More information about the Tarantool-patches mailing list