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 5610913D631A; Tue, 10 Jun 2025 19:22:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5610913D631A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1749572550; bh=4w5g7WHQt6fh/zo9kGRtqqqym0aUhmYhcWY7wR6K2+c=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=FPShL3sLZ5zmtWBRzgnrDc+Fbvy+fgf1IpjhEb76kR6Z71BqJjixBR8HveUOp+zcc DzX1axAiobIlJ241zssi1DXsA7/CfGSrfOp2LvmH/tt+bxF/4S2poAyLGzcH6TXzXB IaRcfERpa1iP3hpmoGsCSp/D8eJba6MLmF4ah9hE= Received: from send218.i.mail.ru (send218.i.mail.ru [95.163.59.57]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 7421E13D6319 for ; Tue, 10 Jun 2025 19:22:28 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7421E13D6319 Received: by exim-smtp-85b97957d7-86whp with esmtpa (envelope-from ) id 1uP1k3-00000000NyE-2js0; Tue, 10 Jun 2025 19:22:27 +0300 Date: Tue, 10 Jun 2025 19:22:32 +0300 To: Sergey Bronnikov Cc: tarantool-patches@dev.tarantool.org Message-ID: References: <1152e27d618a4717c0f48cb77d085434eb183b18.1749550966.git.skaplun@tarantool.org> <9d1c7b94-b18d-4290-b017-27ac9e4f6ef2@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9d1c7b94-b18d-4290-b017-27ac9e4f6ef2@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD909B82214CC9889170BE0B50625C535576E4D105B574000C800894C459B0CD1B9C0E05D19579B275F66FA44935DFD412422596628CE2AC40BB8F3EB953CC2C106EC456C66D2279EA7 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE702C8878A98595F58EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AC83A81C8FD4AD23D82A6BABE6F325AC2E85FA5F3EDFCBAA7353EFBB553375668906014A252870FC4C1BFD131965880FEA569EB002D765D25CCA4B54836485EA389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C0A29E2F051442AF778941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B6D52CD31C43BF465FCC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB86D1867E19FE14079C09775C1D3CA48CF3D321E7403792E342EB15956EA79C166A417C69337E82CC275ECD9A6C639B01B78DA827A17800CE72F88032165008D51731C566533BA786AA5CC5B56E945C8DA X-C1DE0DAB: 0D63561A33F958A57110ED99DC8463D85002B1117B3ED696214C9A7D3FD687334869453249F34FA4823CB91A9FED034534781492E4B8EEAD0942DC5495D0595EBDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADBF74143AD284FC7177DD89D51EBB7742424CF958EAFF5D571004E42C50DC4CA955A7F0CF078B5EC49A30900B95165D34F0A5F58274334C957739A26D6128E9B042215A57F8AC7ADD4C9CFFECA53BB472EAEF29B890F07CA41D7E09C32AA3244C2CCCDF2FACFE370377DD89D51EBB77422DB9497E3AC20F4DEA455F16B58544A2E30DDF7C44BCB90DA5AE236DF995FB59829709634694AABAED6A17656DB59BCAD427812AF56FC65B X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVSykAyseJQ6/cvxD030Uyro= X-DA7885C5: D6B2EE92828946BFF255D290C0D534F945AF7C961E85A7369AB2DF6E6CB8943BF9D357D416F6D8625B1A4C17EAA7BC4BEF2421ABFA55128DAF83EF9164C44C7E X-Mailru-Sender: 689FA8AB762F7393FE9E42A757851DB6EFB0A6E384307378519135F60D49E0BC805A503281635CE6E49D44BB4BD9522A059A1ED8796F048DB274557F927329BE89D5A3BC2B10C37545BD1C3CC395C826B4A721A3011E896F X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 2/2] Different fix for partial snapshot restore due to stack overflow. 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 Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Sergey! Thanks for the review! Please, consider my answer below. On 10.06.25, Sergey Bronnikov wrote: > Hello, Sergey! > > Thanks for the patch! See a comment below. > > Sergey > > On 6/10/25 13:28, Sergey Kaplun wrote: > > From: Mike Pall > > > > Reported by Junlong Li. Fixed by Peter Cawley. > > > > (cherry picked from commit 86e7123bb1782a5f200ba5e83b8c4f3fbad4f7bc) > > > > This patch is a follow-up to the previous commit, which leads to a dirty > > read of the pseudo-valid PC set for the cframe on snapshot restoration. > > To avoid these dirty reads, this patch sets the PC to the outer frame > > as well before possible error throwing. > > > > Sergey Kaplun: > > * added the description and the test for the problem > > > > Part of tarantool/tarantool#11278 > > --- > > src/lj_snap.c | 3 +- > > src/lj_trace.c | 4 +- > > ...-1196-stack-overflow-snap-restore.test.lua | 65 +++++++++++++++++++ > > 3 files changed, 68 insertions(+), 4 deletions(-) > > create mode 100644 test/tarantool-tests/lj-1196-stack-overflow-snap-restore.test.lua > > > > diff --git a/src/lj_snap.c b/src/lj_snap.c > > index 8d7bd868..4cfae579 100644 > > --- a/src/lj_snap.c > > +++ b/src/lj_snap.c > > diff --git a/test/tarantool-tests/lj-1196-stack-overflow-snap-restore.test.lua b/test/tarantool-tests/lj-1196-stack-overflow-snap-restore.test.lua > > new file mode 100644 > > index 00000000..942d1f82 > > --- /dev/null > > +++ b/test/tarantool-tests/lj-1196-stack-overflow-snap-restore.test.lua > > @@ -0,0 +1,65 @@ > > +local tap = require('tap') > > + > > +-- Test file to demonstrate LuaJIT dirty reads after stack > > +-- overflow during restoration from the snapshot. > > +-- The test fails before the patch under Valgrind. > > Please specify valgrind option that is required for reproducing the bug. This just mean the default valgrind settings (without any flags). > > Cannot reproduce with command line below with reverted patch: > > VALGRIND_OPTS="--leak-check=no --malloc-fill=0x00 --free-fill=0x00" > ctest -V -R test/tarantool-tests/lj-1196-partial-snap-restore.test.lua -V This doesn't fail due to --leadk-check=no flag. Also, I suppose this should fail under ASan. > > > +-- > > +-- luacheck: push no max_comment_line_length > > +-- > > +-- See also:https://github.com/LuaJIT/LuaJIT/issues/1196, > > +--https://www.freelists.org/post/luajit/Invalid-read-found-by-valgrind. > > +-- > > +-- luacheck: pop > > + > > +test:done(true) -- Best regards, Sergey Kaplun