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 E75516EC40; Thu, 19 Aug 2021 10:42:46 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E75516EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1629358967; bh=vdDGsheJdyYUK5+UrQv1HrXiqN6gP0+tNMeugg2IpuQ=; 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=B/evl1WqUshulEz70JfbygPIeyw5hcfsklaj1nWomY/tE2YAz82HfW6dhIr62BJm0 Lo1kicUkUsEsQUf9GkggSeoPy/ajmMFChlpEyqsuzy67h4utuFimSgShWFDRVuP4gN pe7iaLRFKKnox0SSKnxaVzuIH2EbCOWk0394u0Ac= Received: from smtp44.i.mail.ru (smtp44.i.mail.ru [94.100.177.104]) (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 00C686EC40 for ; Thu, 19 Aug 2021 10:42:44 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 00C686EC40 Received: by smtp44.i.mail.ru with esmtpa (envelope-from ) id 1mGchI-0002lG-1N; Thu, 19 Aug 2021 10:42:44 +0300 Date: Thu, 19 Aug 2021 07:42:43 +0000 To: Sergey Kaplun Message-ID: <20210819074243.y6oezbujtffjmoiu@tarantool.org> References: <20210816101949.25035-1-skaplun@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210816101949.25035-1-skaplun@tarantool.org> User-Agent: NeoMutt/20170113 (1.7.2) X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92087353F0EC44DD906AB4890CDABF0C5CB76CEE71D3E4007182A05F5380850404645E946B799A6420ACE287FE3F45C244F8FF140B7ACEA4ABB88C7A2AEE1AA5B X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE78CB87876C5D626D4EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063703E3935C5A8197E98638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D816698E415B224809D1D5312090EEDC8E117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF1175FABE1C0F9B6A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD1828451B159A507268D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE4B6963042765DA4B8F49F126DDB898E8D8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE3724336BCC0EE1BA8AD7EC71F1DB88427C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637A7EFCB0EB5ACB161EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: 0D63561A33F958A57F9705DCAC81F2CF26240AD365BD786857245F780B10E799D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA758B25CD4253D1D611410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D344888A9AABCDD3225BAD912FFF820D2DBFD221C9BD0D0A0CE70A06F2649E272074841010818566CE11D7E09C32AA3244C5C63CDC5A8B7A072A3DD6535A9CFDA5769B6CAE0477E908DFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojGSxK+6r6oBGDIkGN/KPx0g== X-Mailru-Sender: 05EB39F83D09414F9B5D7F52D7CDFDD2DE3DBFAAA0E8605F058DE25ADDD271D957BF939C6BBDF487CA16B95394F0DD5CE99530A0C0F27B5268329DCED823713783C0E760C018FF54112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] core: fix cur_L restoration on error throw 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: Kirill Yukhin via Tarantool-patches Reply-To: Kirill Yukhin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hello, On 16 авг 13:19, Sergey Kaplun wrote: > This change is a kind of revertion of commits > ed412cd9f55fe87fd32a69c86e1732690fc5c1b0 ('Update cur_L on exceptional > path') and 97699d9ee2467389b6aea21a098e38aff3469b5f ('Fix cur_L tracking > on exceptional path'). > > When an error is thrown on the coroutine that is not the one being > currently executed, `cur_L` is not set up. Hence, when the running trace > exits at assertion guard right after the error is caught, Lua state is > restored from the incorrect `cur_L`. As a result the resulting stack is > inconsistent and the crash occurs. > > Aforementioned patches fix the behaviour only for x86/x64 > architectures. This patch updates the `cur_L` within `lj_err_throw()` to > the given lua_State, where the error is raised, since this is the only > coroutine that can proceed later. Also, it removes unnecessary > restorations of `cur_L` at C and FF exception handlers in the VM. > > Nevertheless, throwing an error at non-currently executed coroutine is a > violation of Lua/C API. So, in the nearest possible future this patch > should be replaced within the corresponding assert. > > Resolves tarantool/tarantool#6189 > Relates to tarantool/tarantool#6323 > Follows up tarantool/tarantool#1516 LGTM. -- Regards, Kirill Yukhin