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 C3FD4A7E30D; Tue, 12 Mar 2024 15:21:19 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C3FD4A7E30D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1710246079; bh=Gy6tlyOYQyZaJNBANfqD6n0somc8MrZqzayrDMUwx54=; 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=JgelGYyQ/MwbqqgepWd4MkjMxCbRHzu+w5op4njSq29ppYN3hgejItKIcna3zLGW3 omAdab/WaPSV9J6gNqTYavz+gMaz8FJJyqR0pHnxDbat7F7lkUoK0NrB8WtpuFvSzd V8iXASIt17e/j4oUoX7cGOvFL9sKheOPJzaBVkH4= Received: from smtp61.i.mail.ru (smtp61.i.mail.ru [95.163.41.99]) (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 BE8F5A7E301 for ; Tue, 12 Mar 2024 15:21:18 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org BE8F5A7E301 Received: by smtp61.i.mail.ru with esmtpa (envelope-from ) id 1rk188-00000005PLm-3AoC; Tue, 12 Mar 2024 15:21:17 +0300 Date: Tue, 12 Mar 2024 15:21:15 +0300 To: Sergey Kaplun Message-ID: References: <20240312052627.21222-1-skaplun@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240312052627.21222-1-skaplun@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD987C0EE6E7F0A597D2604A3BCAEBFC93637641474DCE2D7B2182A05F538085040CB3C9C1178B8BD9ED27678DDAA806314CCA97186227067062ACA958BA2511ACB32395092C4B9E977 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE78524CA6C6209E9ADEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637817108B649554FEC8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8CF8AC367A6B9ACE9F092721364F54379FE2CD8867F1D7020CC7F00164DA146DAFE8445B8C89999728AA50765F7900637F924B32C592EA89F389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC82FFDA4F57982C5F4F6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA7E827F84554CEF5019E625A9149C048EE33AC447995A7AD182BEBFE083D3B9BA73A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E73557739F23D657EF2BB5C8C57E37DE458BEDA766A37F9254B7 X-C1DE0DAB: 0D63561A33F958A5EDD08858BAE230C95002B1117B3ED696793F0ED8F9529C6330C8F815570A3530823CB91A9FED034534781492E4B8EEADAE4FDBF11360AC9BBDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFF9919743575911AAC93CD23D3422E26120B037930189F1E99F14CE3CF839A0C4CBE0296D7E8D7E7C7C77D8D956826D33DA27E632F158825CE6ABDD0A9DEA1DCC67A2AB48250282DC5F4332CA8FE04980913E6812662D5F2A54F6898A6FDCBDC72A617DFBE5FEC2C6383653B6C8D9AE0FD16FCAA6493B703A X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojWDseZ7hBpnhVUJ7EPB4G1A== X-DA7885C5: 92A550E00DE82746F255D290C0D534F96693E9B70C7B7F3A0AFA41132411388E5B5D7B7083BBBA1FD58A62FD7D354DCE90A62EE20EBFBCA6DE9604509FAD3A5C X-Mailru-Sender: 689FA8AB762F7393590D8C940224AE33161F8547A645DF72CAD0B8CDD30D333EC5ABAEFAF6585931563E610FBBDBB4C842051EA7CBBFB5097AB92FA4D94F20E3E33C1B503AADE26945BD1C3CC395C826B4A721A3011E896F X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] Check frame size limit before returning to a lower frame. 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: Maxim Kokryashkin via Tarantool-patches Reply-To: Maxim Kokryashkin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Sergey! Thanks for the patch! LGTM, except for the single comment below. On Tue, Mar 12, 2024 at 08:26:27AM +0300, Sergey Kaplun wrote: > From: Mike Pall > > Thanks to Sergey Kaplun. > > (cherry picked from commit 302366a33853b730f1b7eb61d792abc4f84f0caa) > > When compiling a stitched (or side) trace, there is no check for the > frame size of the current prototype during recording. Hence, when we > return (for example, after stitching) to the lower frame with a maximum > possible frame size (249), the 251 = `baseslot` (2) + `maxslot` (249) > slot for GC64 mode may be used. This leads to the corresponding assertion > failure in `rec_check_slots()`. > > This patch adds the corresponding check. > > Sergey Kaplun: > * added the description and the test for the problem > > Part of tarantool/tarantool#9595 > --- > > Branch: https://github.com/tarantool/luajit/tree/skaplun/lj-1173-frame-limit-lower-frame > Tarantool PR: https://github.com/tarantool/tarantool/pull/9791 > Related issues: > * https://github.com/tarantool/tarantool/issues/9595 > * https://github.com/LuaJIT/LuaJIT/issues/1173 > > src/lj_record.c | 2 + > .../lj-1173-frame-limit-lower-frame.test.lua | 83 +++++++++++++++++++ > 2 files changed, 85 insertions(+) > create mode 100644 test/tarantool-tests/lj-1173-frame-limit-lower-frame.test.lua > > diff --git a/src/lj_record.c b/src/lj_record.c > index c01c1f0b..e3590b1a 100644 > --- a/src/lj_record.c > +++ b/src/lj_record.c > diff --git a/test/tarantool-tests/lj-1173-frame-limit-lower-frame.test.lua b/test/tarantool-tests/lj-1173-frame-limit-lower-frame.test.lua > new file mode 100644 > index 00000000..91e2c603 > --- /dev/null > +++ b/test/tarantool-tests/lj-1173-frame-limit-lower-frame.test.lua > @@ -0,0 +1,83 @@ > +local chunk = 'local uv = {key = 1}\n' > +chunk = chunk .. 'return function()\n' > +chunk = chunk .. 'local r = retf()\n' Kind of a strange way to define a chunk. I believe that multiline is better here. > + > +-- Each `UGET` occupies 1 slot, `KNIL` occupies the same amount. > +-- 1 slot is reserved (`r` variable), 1 pair is set outside the > +-- cycle. 249 slots (the maximum available amount, see > +-- , `bcreg_bump()` for details) are occupied in > +-- total. > +for _ = 1, LJ_MAX_JSLOTS / 2 - 2 do > + chunk = chunk .. ('uv.key, ') > +end > +chunk = chunk .. 'uv.key = nil\n' > +chunk = chunk .. 'end\n' Same applies here. > + > +local get_func = assert(loadstring(chunk)) > +local function_max_framesize = get_func() > + > +jit.opt.start('hotloop=1', 'hotexit=1') > + > +-- Compile the parent trace first. > +retf() > +retf() > + > +-- Try to compile the side trace with a return to a lower frame > +-- with a huge frame size. > +function_max_framesize() > +function_max_framesize() > + > +-- XXX: The limit check is OK with default defines for non-GC64 > +-- mode, the trace is compiled for it. The test fails only with > +-- GC64 mode enabled. Still run the test for non-GC64 mode to > +-- avoid regressions. > + > +test:ok(true, 'no assertion failure during recording') > + > +test:done(true) > -- > 2.44.0 >