From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: Sergey Ostanevich <sergos@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH luajit 3/4] ARM64: Fix xpcall() error case. Date: Fri, 4 Jun 2021 16:45:31 +0300 [thread overview] Message-ID: <YLoue4+ghUu51K1A@root> (raw) In-Reply-To: <7C1088AE-38B5-4DE2-BE8B-4D2B2754BB7F@tarantool.org> Hi! Thanks for the review! On 02.06.21, Sergey Ostanevich wrote: > Hi! > > Thanks for the patch! > > Some comments facelift, otherwise LGTM. > > Sergos > > > > On 24 May 2021, at 16:27, Sergey Kaplun <skaplun@tarantool.org> wrote: > > > > From: Mike Pall <mike> > > > > Thanks to Stefan Pejic. > > > > (cherry picked from commit 33082a6f4778aa152f6a4a684a7fe79436f1ecb6) > > > > Premature incrementing VM's BASE register before switch to fff_fallback > increment of > > handler during processing `xpcall()` fast function leads to incorrect > > L->base value in case, when `xpcall()` calls without a second argument > is called > > or if it equals nil (see <301-basic.t> test in lua-Harness test suite). > > While further error processing it leads to crash, due to stack > > inconsistency. > > Please, mention explicitly if this test is the one for the patch. > > > > > This patch moves BASE incrementing after possible switching to > increment the switch (mentioned in first line) > > fallback handler. > the (aforementioned) > > > > Sergey Kaplun: > > * added the description for the problem > > > > Part of tarantool/tarantool#6093 > > Part of tarantool/tarantool#5629 > > --- The new commit message is: Branch is force-pushed. =================================================================== ARM64: Fix xpcall() error case. Thanks to Stefan Pejic. (cherry picked from commit 33082a6f4778aa152f6a4a684a7fe79436f1ecb6) Premature increment of VM's BASE register before switch to fff_fallback handler during processing `xpcall()` fast function leads to incorrect L->base value in the case, when `xpcall()` is called without a second argument or if it equals nil (see <301-basic.t> test in lua-Harness test suite). While further error processing it leads to crash (see the test case in <test/lua-Harness-tests/301-basic.t:832>), due to stack inconsistency. This patch moves BASE increment after the switch (mentioned in the first line) to the fallback handler (aforementioned). Sergey Kaplun: * added the description for the problem Part of tarantool/tarantool#6093 Part of tarantool/tarantool#5629 =================================================================== > > src/vm_arm64.dasc | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/src/vm_arm64.dasc b/src/vm_arm64.dasc > > index 6bf59509..e16a77ab 100644 > > --- a/src/vm_arm64.dasc > > +++ b/src/vm_arm64.dasc > > @@ -1186,12 +1186,12 @@ static void build_subroutines(BuildCtx *ctx) > > | subs NARGS8:RC, NARGS8:RC, #16 > > | blo ->fff_fallback > > | mov RB, BASE > > - | add BASE, BASE, #24 > > | asr ITYPE, CARG2, #47 > > | ubfx TMP0w, TMP0w, #HOOK_ACTIVE_SHIFT, #1 > > | cmn ITYPE, #-LJ_TFUNC > > | add PC, TMP0, #24+FRAME_PCALL > > | bne ->fff_fallback // Traceback must be a function. > > + | add BASE, BASE, #24 > > | stp CARG2, CARG1, [RB] // Swap function and traceback. > > | cbz NARGS8:RC, ->vm_call_dispatch > > | b <1 > > -- > > 2.31.0 > > > -- Best regards, Sergey Kaplun
next prev parent reply other threads:[~2021-06-04 13:46 UTC|newest] Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-24 13:27 [Tarantool-patches] [PATCH luajit 0/4] Fix LuaJIT tests on aarch64, odroid Sergey Kaplun via Tarantool-patches 2021-05-24 13:27 ` [Tarantool-patches] [PATCH luajit 1/4] ARM, ARM64, PPC: Fix TSETR fallback Sergey Kaplun via Tarantool-patches 2021-06-02 12:04 ` Sergey Ostanevich via Tarantool-patches 2021-06-04 13:12 ` Sergey Kaplun via Tarantool-patches 2021-06-04 15:33 ` Sergey Ostanevich via Tarantool-patches 2021-06-04 15:39 ` Sergey Kaplun via Tarantool-patches 2021-06-10 13:51 ` Igor Munkin via Tarantool-patches 2021-06-11 8:47 ` Sergey Kaplun via Tarantool-patches 2021-06-12 13:09 ` Sergey Kaplun via Tarantool-patches 2021-05-24 13:27 ` [Tarantool-patches] [PATCH luajit 2/4] test: add skipcond on architectures for memprof Sergey Kaplun via Tarantool-patches 2021-06-02 12:28 ` Sergey Ostanevich via Tarantool-patches 2021-06-04 13:37 ` Sergey Kaplun via Tarantool-patches 2021-06-04 15:36 ` Sergey Ostanevich via Tarantool-patches 2021-06-04 16:18 ` Sergey Kaplun via Tarantool-patches 2021-06-10 13:51 ` Igor Munkin via Tarantool-patches 2021-06-11 8:18 ` Sergey Kaplun via Tarantool-patches 2021-05-24 13:27 ` [Tarantool-patches] [PATCH luajit 3/4] ARM64: Fix xpcall() error case Sergey Kaplun via Tarantool-patches 2021-06-02 12:47 ` Sergey Ostanevich via Tarantool-patches 2021-06-04 13:45 ` Sergey Kaplun via Tarantool-patches [this message] 2021-06-10 13:51 ` Igor Munkin via Tarantool-patches 2021-05-24 13:27 ` [Tarantool-patches] [PATCH luajit 4/4] ARM64: Fix xpcall() error case (really) Sergey Kaplun via Tarantool-patches 2021-06-02 14:43 ` Sergey Ostanevich via Tarantool-patches 2021-06-04 13:56 ` Sergey Kaplun via Tarantool-patches 2021-06-10 13:52 ` Igor Munkin via Tarantool-patches 2021-06-11 8:08 ` Sergey Kaplun via Tarantool-patches 2021-06-01 11:11 ` [Tarantool-patches] [PATCH luajit 0/4] Fix LuaJIT tests on aarch64, odroid Igor Munkin via Tarantool-patches 2021-06-12 16:02 ` Igor Munkin via Tarantool-patches
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=YLoue4+ghUu51K1A@root \ --to=tarantool-patches@dev.tarantool.org \ --cc=sergos@tarantool.org \ --cc=skaplun@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH luajit 3/4] ARM64: Fix xpcall() error case.' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox