[Tarantool-patches] [PATCH luajit] Fix maxslots when recording BC_TSETM.

Igor Munkin imun at tarantool.org
Fri Sep 1 18:45:19 MSK 2023


Sergey,

I've checked the patchset into all long-term branches in
tarantool/luajit and bumped a new version in master, release/2.11 and
release/2.10.

On 25.08.23, Sergey Kaplun via Tarantool-patches wrote:
> From: Mike Pall <mike>
> 
> Analyzed by Sergey Kaplun.
> 
> (cherry-picked from commit 0cc5fdfbc0810073485150eb184dc358dab507d9)
> 
> Recording of the `BC_TSETM` bytecode may keep too optimistic JIT
> maxslot. In that case, the slot above the top of the Lua stack may be
> considered used. When any VM event handler is called before the
> recording of the next instruction, this leads to an assertion failure in
> `rec_check_slots()`.
> 
> This patch sets the `ra` as a maxslot, as far as the `ra` - 1 contains a
> table, which is always the highest slot after this bytecode. Also, it
> adds an assertion that we check slots below the top of the Lua stack.
> 
> Sergey Kaplun:
> * added the description and the test for the problem
> 
> Part of tarantool/tarantool#8825
> ---
> 
> Branch: https://github.com/tarantool/luajit/tree/skaplun/lj-1025-tsetm-maxslot
> Tarantool PR: https://github.com/tarantool/tarantool/pull/9040
> Issues:
> * https://github.com/LuaJIT/LuaJIT/issues/1025
> * https://github.com/tarantool/tarantool/issues/8825
> 
>  src/lj_record.c                               |  2 +
>  .../lj-1025-tsetm-maxslot.test.lua            | 52 +++++++++++++++++++
>  2 files changed, 54 insertions(+)
>  create mode 100644 test/tarantool-tests/lj-1025-tsetm-maxslot.test.lua
> 

<snipped>

> -- 
> 2.41.0
> 

-- 
Best regards,
IM


More information about the Tarantool-patches mailing list