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 607257030C; Mon, 24 May 2021 16:30:18 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 607257030C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1621863018; bh=ykUZhn/DqAzlLGo2/MXa3r0x+D1gAMI5mxVpnny7A6I=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=YlcDOn/NdLkaXbT6wC8pE2RKQjegIF8ksogudf/EMQOEtgd/hUebNtsyv+k40utAY yb1zATtNotxbGLaFoaoukEM8VNEmXMvTzXG2gqDn7Z8UaNWief5cPk6C1aRL4P14Zr gt+pSrSjHkvOZqzBq83OTO6pNS9Ij2GxexERXXIc= Received: from smtp29.i.mail.ru (smtp29.i.mail.ru [94.100.177.89]) (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 AF08674141 for ; Mon, 24 May 2021 16:28:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org AF08674141 Received: by smtp29.i.mail.ru with esmtpa (envelope-from ) id 1llAdT-0002uA-Po; Mon, 24 May 2021 16:28:48 +0300 To: Igor Munkin , Sergey Ostanevich Date: Mon, 24 May 2021 16:27:32 +0300 Message-Id: <4bd78b1efb16ad18aa23328d77f5c55d76094c25.1621859367.git.skaplun@tarantool.org> X-Mailer: git-send-email 2.31.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD91B019B01C53E51AFCAACD197781D6F0CB42DE8FB7A42148700894C459B0CD1B9A4737E4F7D62546B4078449E6F13608415943EE8DFA7CAB93DBFFC9DE3409321 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE771540F9ECFC94C4BEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637F72512A705E00D288638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8072C1DC86D519A9FB922BD4056623B17117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC974A882099E279BDA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735201E561CDFBCA1751FF04B652EEC242312D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6A1DCCEB63E2F10FB089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CDFB9373DB28FDDFB938D38B354C2994549085D04BF827AB69C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF92B0BE0DA6BB795D699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34C1D376EF32BB0896FE15BFBA49DBB6A5B41311775013F13542A74C307AD9B3DEDA3FC346461FCFA51D7E09C32AA3244C9545AEF8CCFC23CEF2A1A375833FF08FC3B3ADDA61883BB5927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojbL9S8ysBdXhAIdl7nGLKX6UdcLkHr9vF X-Mailru-Sender: 3B9A0136629DC91206CBC582EFEF4CB43734350F3990CB1C1177EFA429EB51CF21A452A5DC2D61BFF2400F607609286E924004A7DEC283833C7120B22964430C52B393F8C72A41A89437F6177E88F7363CDA0F3B3F5B9367 X-Mras: Ok Subject: [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" From: Mike Pall Thanks to Stefan Pejic. (cherry picked from commit 33082a6f4778aa152f6a4a684a7fe79436f1ecb6) Premature incrementing VM's BASE register before switch to fff_fallback handler during processing `xpcall()` fast function leads to incorrect L->base value in case, when `xpcall()` calls 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, due to stack inconsistency. This patch moves BASE incrementing after possible switching to fallback handler. 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