[Tarantool-patches] [PATCH luajit 4/4] ARM64: Fix xpcall() error case (really).

Sergey Kaplun skaplun at tarantool.org
Fri Jun 11 11:08:08 MSK 2021


Hi, Igor!

Thanks for the review!

On 10.06.21, Igor Munkin wrote:
> Sergey,
> 
> Thanks for the patch! There are still typos left after fixing Sergos
> review comments (the commit message is taken from the branch).
> Otherwise, LGTM.
> 
> | ARM64: Fix xpcall() error case (really).
> |
> | Thanks to François Perrad and Stefan Pejic.
> |
> | (cherry picked from commit d417ded17945b4211608d497d50b509e0274f5e0)
> |
> | Premature decrement of VM's RC register before switch to fff_fallback
> | handler during processing `xpcall()` fast function leads to incorrect
> | stack layout (not enough arguments on stack), when `xpcall()` calls
> 
> Typo: s/calls/is called/.
> 
> | without a second argument or if it is not a function (see
> | <test/lua-Harness-tests/301-basic.t:832>
> 
> Typo: looks like line underfull (in LaTeX terms).
> 
> | test in lua-Harness test suite). While further error processing it leads
> | to incorrect error message, due to stack inconsistency.
> |
> | This patch stores intermediate result into TMP1 register (it does not
> | determine fallback's behaviour and there is no way to return from
> | fallback back to xpcall processing with spoiled TMP1) and moves RC
> | setting after the switch to the fallback handler.
> |
> | Sergey Kaplun:
> | * added the description for the problem
> |
> | Resolves tarantool/tarantool#6093
> | Part of tarantool/tarantool#5629

Fixed. Branch is force-pushed:

The new commit message is:

===================================================================
ARM64: Fix xpcall() error case (really).

Thanks to François Perrad and Stefan Pejic.

(cherry picked from commit d417ded17945b4211608d497d50b509e0274f5e0)

Premature decrement of VM's RC register before switch to fff_fallback
handler during processing `xpcall()` fast function leads to incorrect
stack layout (not enough arguments on stack), when `xpcall()` is called
without a second argument or if it is not a function (see
<test/lua-Harness-tests/301-basic.t:832> test in lua-Harness test
suite). While further error processing it leads to incorrect error
message, due to stack inconsistency.

This patch stores intermediate result into TMP1 register (it does not
determine fallback's behaviour and there is no way to return from
fallback back to xpcall processing with spoiled TMP1) and moves RC
setting after the switch to the fallback handler.

Sergey Kaplun:
* added the description for the problem

Resolves tarantool/tarantool#6093
Part of tarantool/tarantool#5629
===================================================================

> 
> -- 
> Best regards,
> IM

-- 
Best regards,
Sergey Kaplun


More information about the Tarantool-patches mailing list