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 6DFB56EC40; Wed, 2 Jun 2021 15:47:37 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6DFB56EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1622638057; bh=4Ri9kKv9y8sQf3i+7EssA3w91h+e6wb9SO7rka46mko=; h=In-Reply-To:Date:References:To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=v+cEtmawR6Ktm5e0efEvINqIHup02vknA12pF4ffJPoIderx/xKvNeKKJ9qsOa00g ubGpKWWZ+kfc2JGbQEgaQ7riRNh4LIuhU7OBvCLzhq8Q+q9r33ZXGjVM8ndyuyZrUD +lnppLFmja0GL+ksDPiVmLVFwnXkXuWcD8QJx87E= Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (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 A4E086EC40 for ; Wed, 2 Jun 2021 15:47:36 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A4E086EC40 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1loQHX-0004i8-PI; Wed, 02 Jun 2021 15:47:36 +0300 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) In-Reply-To: <4bd78b1efb16ad18aa23328d77f5c55d76094c25.1621859367.git.skaplun@tarantool.org> Date: Wed, 2 Jun 2021 15:47:35 +0300 Content-Transfer-Encoding: 7bit Message-Id: <7C1088AE-38B5-4DE2-BE8B-4D2B2754BB7F@tarantool.org> References: <4bd78b1efb16ad18aa23328d77f5c55d76094c25.1621859367.git.skaplun@tarantool.org> To: Sergey Kaplun X-Mailer: Apple Mail (2.3654.60.0.2.21) X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9D5B0DA836B685C54F4BC37E91F2690B85F43D7652182C513182A05F538085040297ACAA5A0F9BE628B83C0150C47CED0D6FC6714B4CB1522BD85B9CC454A1BE0 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7F1942E6D70B4A2F0EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637D3219148F76DED538638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8AFACE9F78D60C3361488C3A83A3D8542117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC2EE5AD8F952D28FBA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18BDFBBEFFF4125B51D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B67ECBC18655D52CDF089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A57B53A81C88A0BC235A27C835D21DD40AAF19A450ACE985D9D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75FBC5FED0552DA851410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34C1E32F4AD4B2486B2412E3B761ACBF7EC15F8202DA4C72515FCDDE194AAED3674BAD4591D22140A61D7E09C32AA3244C0A2E169514FF36D20EAA42E5215C2DB081560E2432555DBBFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj+mfSpkNmA2rrUZYVOiiqvg== X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638224FBD98FD902B8964AD0971CB292B7C62D86460CE94ACC410B98B9A657DE05FA7FB559BB5D741EB96F714CF339B3F4B0DA5517EFC3E06706F67EA787935ED9F1B 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 Ostanevich via Tarantool-patches Reply-To: Sergey Ostanevich Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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 > --- > 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 >