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 6DD64A1A05A; Thu, 8 Feb 2024 16:05:35 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6DD64A1A05A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1707397535; bh=UzorX/Ecu+Gt90AXjPoOLzDC5rnZDr7NlbbPOISijwQ=; 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=WlFR9h3Y4NHUxQl2l1Jj6T0yNDZ5ZJj0SZ/37azhzepEHycLPSJCB+pm/HHywzE5C q4fBJ+x8chWg3lzV2NgvohkmHXUQzGkC1P+cYxBfYmTFZfbQNmN7P8ngZzThQeXJ0y PA51Wph7uy0ysMGPAhXZSXS8rR+ss77BXznD6mfI= Received: from smtp29.i.mail.ru (smtp29.i.mail.ru [95.163.41.68]) (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 93D0F40E76C for ; Thu, 8 Feb 2024 16:05:33 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 93D0F40E76C Received: by smtp29.i.mail.ru with esmtpa (envelope-from ) id 1rY45s-00000003Opq-2ye5; Thu, 08 Feb 2024 16:05:33 +0300 Message-ID: <8d4da121-e851-4b20-80d5-0254edff8d96@tarantool.org> Date: Thu, 8 Feb 2024 16:05:32 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Sergey Kaplun References: <20240207120648.12416-1-skaplun@tarantool.org> <8e9ceb71-4234-4b72-9f76-80f164ca591d@tarantool.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD91FEFD63CE1B099162296A97A0CC14860CD7C04226BA1026C00894C459B0CD1B983B89220CDCC0A16FB835C701CFFEE0AF3BFA7BE4E4CD467F7157B86E07BB8DB4F193C0F926A29E4 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE705C173BDDADFC82AEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006370EBB47D88F71BB738638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8AF581AF3679AD3151B4D612A6C77BFE492913751A1F476F7CC7F00164DA146DAFE8445B8C89999728AA50765F790063793270F7220657A0A389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC821E93C0F2A571C7BF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA73AA81AA40904B5D9A18204E546F3947C632EDEA9CD5989A39735652A29929C6C4AD6D5ED66289B523666184CF4C3C14F6136E347CC761E07725E5C173C3A84C31DA0D137B259B101BA3038C0950A5D36B5C8C57E37DE458B330BD67F2E7D9AF16D1867E19FE14079C09775C1D3CA48CFE478A468B35FE7671DD303D21008E298D5E8D9A59859A8B6B372FE9A2E580EFC725E5C173C3A84C37727919777A35F2B35872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-C1DE0DAB: 0D63561A33F958A5BBD76FC10E913E625002B1117B3ED6961E596CA3A4BC29BCFB820E9FE7BD014C823CB91A9FED034534781492E4B8EEAD21D4E6D365FE45D1BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFA0CDEFB4A40A7E92989C8870C7867BFC8C3D4CE558081F916EAB3FE088D59DCA16D5D591715857EC766A7423F6D95CBE50F0169D723BF5D4A6489333F0C07452FC446891D7E06F915F4332CA8FE04980913E6812662D5F2AB9AF64DB4688768036DF5FE9C0001AF333F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojlN/n4z3iVuRBf52R2WUKDw== X-Mailru-Sender: C4F68CFF4024C8867DFDF7C7F2588458CAF643D9C7DAED5D05E38EDE555C280659BCFEA6454308EBB83AD1CD96C067B3645D15D82EE4B272BD6E4642A116CA93524AA66B5ACBE6721EF430B9A63E2A504198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] Avoid out-of-range number of results when compiling select(k, ...). 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 Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Finally reproduced with the following CMake flags: CMAKE_BUILD_TYPE="Debug" CMAKE_C_COMPILER="clang" CMAKE_EXPORT_COMPILE_COMMANDS:BOOL="TRUE" LUAJIT_ENABLE_COVERAGE:BOOL="FALSE" LUAJIT_ENABLE_GC64:BOOL="TRUE" LUAJIT_USE_ASAN:BOOL="TRUE" LUAJIT_USE_SYSMALLOC:BOOL="TRUE" LUA_USE_APICHECK:BOOL="TRUE"   LUA_USE_ASSERT:BOOL="TRUE" On 2/8/24 12:36, Sergey Kaplun wrote: > Hi, Sergey! > Thanks for the review! > > On 08.02.24, Sergey Bronnikov wrote: >> Hi, Sergey >> >> thanks for the patch >> >> couldn't reproduce a problem by provided test. > As you can see in the test comment, the test failed under ASAN with a > heap buffer overflow. Unfortunately, I didn't come up with an idea of > how to observe the misbehaviour (too long IRs for the trace) without > ASAN. > >> What compilation options I've used: >> >> >> 1st attempt: >> >> cmake -S . -B build -DLUA_USE_ASSERT=ON -DLUA_USE_APICHECK=ON >> >> >> 2nd attempt: >> >> CMAKE_BUILD_TYPE="Debug" >> CMAKE_C_COMPILER="clang" >> CMAKE_EXPORT_COMPILE_COMMANDS:BOOL="TRUE" >> LUAJIT_ENABLE_COVERAGE:BOOL="FALSE" >> LUAJIT_ENABLE_GC64:BOOL="TRUE" >> LUAJIT_USE_ASAN:BOOL="FALSE" >> LUAJIT_USE_SYSMALLOC:BOOL="FALSE" >> LUA_USE_APICHECK:BOOL="TRUE" >>   LUA_USE_ASSERT:BOOL="TRUE" >> >> >> Sergey >> >> On 2/7/24 15:06, Sergey Kaplun wrote: > > >>> +local function varg_frame_wp() >>> + -- XXX: Need some constant negative value as the first argument >>> + -- of `select()` when recording the trace. >>> + -- Also, it should be huge enough to be greater than >>> + -- `J->maxslot`. The value on the first iteration is ignored. >>> + -- This will fail under ASAN due to a heap buffer overflow. >>> + varg_frame(recording and -(LJ_MAX_JSLOTS + 1) or 1) >>> +end > > >>> + >>> +test:done(true)