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 53C0F6EC40; Wed, 2 Jun 2021 17:43:32 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 53C0F6EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1622645012; bh=0INkc998aIQX75SMj6gM13sPRTR9iuu2YUM/9LNDhTM=; 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=TfefZ+MezrPCsKSMH30yqNizj3MGc2+35NpeKXKwEGix2umn8taMSYUqx8sd7m662 jVwGVqJhT9InJBE5oMVldJUL4X0m/O9xMDP8fOa3YFyjMMdV6Y4bzATk0pS8PUa6K3 JH3VotGBd+hZksahP9fcgFBgeMZhhLfRNXtsOKJ4= 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 C0C8A6EC40 for ; Wed, 2 Jun 2021 17:43:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C0C8A6EC40 Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1loS5h-0002FA-RF; Wed, 02 Jun 2021 17:43:30 +0300 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) In-Reply-To: Date: Wed, 2 Jun 2021 17:43:29 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <9F30A4EA-54A0-4D2A-A018-20CAB72A4E3B@tarantool.org> References: To: Sergey Kaplun X-Mailer: Apple Mail (2.3654.60.0.2.21) X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD9D5B0DA836B685C5407454A95E60932C8E3171F0D0805CD56182A05F5380850408966C7D2C8559B00AD27FF81CA66B3ACB0D516F2365EAC4A6A02CD4814573807 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7E50EC9128971FD6EEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637F5B2F26146BDF5648638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D821D5EE91D91DDDF3575ED29ADFC22D9C117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC2EE5AD8F952D28FBA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18BDFBBEFFF4125B51D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B642416645EBD45DC2089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A52FD11990B6EF90BE35748BA1380714A120A9A1CD7D87F594D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75FBC5FED0552DA851410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D349379E7F8541B6C9A053546AAA88F4B6803CA741FB7F50F8C41FE81F73F6364FEF5EF60E281E0746A1D7E09C32AA3244C89280A668D7E6EF987A78F8B5EE8CB3F35DA7DC5AF9B58C0FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj+mfSpkNmA2oUYfT97TIkmw== X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638221D6FEC546C95150DB5DB347C02D5BAF3D86460CE94ACC410B98B9A657DE05FA7FB559BB5D741EB96F714CF339B3F4B0DA5517EFC3E06706F67EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 4/4] ARM64: Fix xpcall() error case (really). 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! Just some updates to the message, LGTM. Sergos > On 24 May 2021, at 16:27, Sergey Kaplun wrote: >=20 > From: Mike Pall >=20 > Thanks to Fran=C3=A7ois Perrad and Stefan Pejic. >=20 > (cherry picked from commit d417ded17945b4211608d497d50b509e0274f5e0) >=20 > Premature decrementing VM's RC register before switch to fff_fallback decrement of > handler during processing `xpcall()` fast function leads to incorrect > stack layout (not enough arguments on stack), when `xpcall()` calls > without a second argument or if it is not a function (see = <301-basic.t> > test in lua-Harness test suite). While further error processing it = leads > to incorrect error message, due to stack inconsistency. Mention this test verifies the patch behavior. >=20 > 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 possible switching to fallback handler. the switch the >=20 > Sergey Kaplun: > * added the description for the problem >=20 > Resolves tarantool/tarantool#6093 > Part of tarantool/tarantool#5629 > --- > src/vm_arm64.dasc | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/src/vm_arm64.dasc b/src/vm_arm64.dasc > index e16a77ab..6e298255 100644 > --- a/src/vm_arm64.dasc > +++ b/src/vm_arm64.dasc > @@ -1183,7 +1183,7 @@ static void build_subroutines(BuildCtx *ctx) > |.ffunc xpcall > | ldp CARG1, CARG2, [BASE] > | ldrb TMP0w, GL->hookmask > - | subs NARGS8:RC, NARGS8:RC, #16 > + | subs NARGS8:TMP1, NARGS8:RC, #16 > | blo ->fff_fallback > | mov RB, BASE > | asr ITYPE, CARG2, #47 > @@ -1191,6 +1191,7 @@ static void build_subroutines(BuildCtx *ctx) > | cmn ITYPE, #-LJ_TFUNC > | add PC, TMP0, #24+FRAME_PCALL > | bne ->fff_fallback // Traceback must be a function. > + | mov NARGS8:RC, NARGS8:TMP1 > | add BASE, BASE, #24 > | stp CARG2, CARG1, [RB] // Swap function and = traceback. > | cbz NARGS8:RC, ->vm_call_dispatch > --=20 > 2.31.0 >=20