From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id A90E76EC40; Fri, 4 Jun 2021 16:46:44 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A90E76EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1622814404; bh=ysZyv9o6pdYQAsa5fH4YwjcAGTBKIqnACPtzgVvFrUE=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ZFwDKQwpipvW1/ol0r013VovjHoQx+AnXxfMIlzxNMbiJFaQHX1pTqxLECR9xVTvV 9Bh5oRojZleYSnzniYdmQ/xLdGdW0hIMrOMF1TV0lTxphhWhM3iBf2ouJdz50deULL yjdScI086tacNhpqj6D5x5RCZXzkKBa5/YtTY4wI= Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 65D8B6EC40 for ; Fri, 4 Jun 2021 16:46:43 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 65D8B6EC40 Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1lpA9q-00038S-Fz; Fri, 04 Jun 2021 16:46:42 +0300 Date: Fri, 4 Jun 2021 16:45:31 +0300 To: Sergey Ostanevich Message-ID: References: <4bd78b1efb16ad18aa23328d77f5c55d76094c25.1621859367.git.skaplun@tarantool.org> <7C1088AE-38B5-4DE2-BE8B-4D2B2754BB7F@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7C1088AE-38B5-4DE2-BE8B-4D2B2754BB7F@tarantool.org> X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9D5B0DA836B685C54F4BC37E91F2690B85F43D7652182C513182A05F538085040CDE4AC82997498422C7D67452CDF820218BD09BD6B6CFBF7D6F96E2D2517D16A X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7A3295C83650092F9EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637BBCE7257090F96C9EA1F7E6F0F101C6723150C8DA25C47586E58E00D9D99D84E1BDDB23E98D2D38BD6CF32B5F8F9D404424E1C2FE2349814AA7035F7FEB90990CC7F00164DA146DAFE8445B8C89999728AA50765F790063783E00425F71A4181389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8ED96AA85C75E140D117882F4460429728AD0CFFFB425014E868A13BD56FB6657E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637427B078F297B269AEFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: 0D63561A33F958A55763786C662B9F36C81E0CE529264458D0B6B931DA054432D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75FBC5FED0552DA851410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3419891600CCEF4607F37CDF84AA6BDD3EDEE97425BB2E932E8F6CC8A0B13338552839237BDBEC92621D7E09C32AA3244C6F3C66145C587717D62770E4C9CCC5018580396430872480FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojz99asgmzejpK5eEZdOM2Mg== X-Mailru-Sender: 689FA8AB762F73936BC43F508A063822B98E483A12089DF1F2EDDB71BC47B13E0FBE9A32752B8C9C2AA642CC12EC09F1FB559BB5D741EB962F61BD320559CF1EFD657A8799238ED567EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 3/4] ARM64: Fix xpcall() error case. X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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 wrote: > > > > From: Mike Pall > > > > 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 ), 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