[Tarantool-patches] [PATCH luajit v2] Fix frame traversal for __gc handler frames.

Igor Munkin imun at tarantool.org
Wed Nov 24 01:00:31 MSK 2021


Sergey,

I've checked the patch into all long-term branches in tarantool/luajit
and bumped a new version in 1.10, 2.8 and master.

On 19.11.21, Sergey Kaplun wrote:
> From: Mike Pall <mike>
> 
> Reported by Changochen.
> 
> (cherry picked from 53f82e6e2e858a0a62fd1a2ff47e9866693382e6)
> 
> A cframe unwinding is missed for a C protected frame during a search for
> an error function to handle a runtime error. It leads to undefined
> behaviour or crash, when raising a runtime error on stack with the CP
> frame before an error function handler (for example, an error in __gc
> handler).
> 
> This patch adds missing unwinding for CP frame.
> 
> Sergey Kaplun:
> * added the description and the test for the problem
> ---
> 
> LuaJIT issue: https://github.com/LuaJIT/LuaJIT/issues/601
> Branch: https://github.com/tarantool/luajit/tree/skaplun/gh-noticket-fix-gc-finderrfunc
> Tarantool branch: https://github.com/tarantool/tarantool/tree/skaplun/gh-noticket-fix-gc-finderrfunc
> 
> Changes in v2:
> * Create CP and C stack manually in LuaC
> 
>  src/lj_err.c                                  |  1 +
>  test/tarantool-tests/CMakeLists.txt           |  1 +
>  .../lj-601-fix-gc-finderrfunc.test.lua        | 35 ++++++++++++
>  .../lj-601-fix-gc-finderrfunc/CMakeLists.txt  |  1 +
>  .../lj-601-fix-gc-finderrfunc/mixcframe.c     | 55 +++++++++++++++++++
>  5 files changed, 93 insertions(+)
>  create mode 100644 test/tarantool-tests/lj-601-fix-gc-finderrfunc.test.lua
>  create mode 100644 test/tarantool-tests/lj-601-fix-gc-finderrfunc/CMakeLists.txt
>  create mode 100644 test/tarantool-tests/lj-601-fix-gc-finderrfunc/mixcframe.c
> 

<snipped>

> -- 
> 2.31.0
> 

-- 
Best regards,
IM


More information about the Tarantool-patches mailing list