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 3ECE019F8E67; Mon, 30 Mar 2026 10:58:47 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3ECE019F8E67 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1774857527; bh=fmPsHjDelqpm9NGmvdCHE6sooAe+OMTlU3aS6w96ZCI=; 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=kSErRppNgyUWzZy/9DQMt4eUFNnlEJD0jIFUOShnK8H4p5yscA7GEaitam6J2rSte S6zCGoV9EKNEjUg0rFwvRgwkIO/A4iW0Mo1STbnmmXDzYG/ppCAT7J57edPtjY5MzG 3OXtOvDG5GcW3W+wq5y4tuTgvWU2EWg+cgUCe28E= Received: from send83.i.mail.ru (send83.i.mail.ru [89.221.237.178]) (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 B946119F8E65 for ; Mon, 30 Mar 2026 10:58:45 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B946119F8E65 Received: by exim-smtp-74865f89dd-rds45 with esmtpa (envelope-from ) id 1w77WG-000000005hU-3CZG; Mon, 30 Mar 2026 10:58:45 +0300 Content-Type: multipart/alternative; boundary="------------QTZxLKsGzv0KfzQNOdYmb5qi" Message-ID: <9c87e62e-b75e-4713-be59-c6036eb9fc4b@tarantool.org> Date: Mon, 30 Mar 2026 10:58:43 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org References: <7c96f2917ce5525a7799a1f327e0981d9a59f84f.1774711616.git.skaplun@tarantool.org> Content-Language: en-US In-Reply-To: <7c96f2917ce5525a7799a1f327e0981d9a59f84f.1774711616.git.skaplun@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9BB347BE606964F7A35618C943ABF452CBCC32B7CE0159B2D182A05F538085040C5997D77FC9C386B3DE06ABAFEAF67056A7D45095D7F3C8BA620D1C0ABB2979DA92BA30E35CD8A73 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7FDE19FEC90BA7BD7C2099A533E45F2D0395957E7521B51C2CFCAF695D4D8E9FCEA1F7E6F0F101C6778DA827A17800CE7811C3E343B302E2EEA1F7E6F0F101C67CDEEF6D7F21E0D1D9295C2E9FA3191EE1B59CA4C82EFA6580AA144242B2D63F9827512DA8877BD974FBAC8FEBFF6B294117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC3733B5EC72352B9FA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735201E561CDFBCA1751F6FD1C55BDD38FC3FD2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B69DC5D3EDC80DC730089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A5B8E7E6EFFF3E1A895002B1117B3ED6967B05A45476E34E8D219207EC0A953D2C823CB91A9FED034534781492E4B8EEAD37F46C620FF2CAEEBDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE191716CD42B3DD1D34CAB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D659D3280A9DEA9813561BA35AD5FF2478C470A2BC4F25A2B6819BDBCF9D16ECF0143B6F67844B6F9FEEB8341EE9D5BE9A0AC4CF337D4BBD19F7ACA6A34E971D1BC85DA669D34C3735F38CD93680B12512CF4C41F94D744909CE2512F26BEC029E55448553D2254B8D95CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVdx/hWl0/CTmqm8WDkukfLc= X-DA7885C5: 9BF0B93C6D49E7A1F255D290C0D534F91BCA40A745430056E72B3A2B472BC96C9D339613453F74845B1A4C17EAA7BC4BEF2421ABFA55128DAF83EF9164C44C7E X-Mailru-Sender: 689FA8AB762F7393520AF17B8A65FDE2BC1D901C2FE7E92D05C28B46344E589FE303338CBE6E7304EF86D5F70DA33880E41E8EF7A07863ECB274557F927329BE2DDF8182D28ACDB545BD1C3CC395C826B4A721A3011E896F X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 1/2] Run VM events and finalizers in separate state. 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 Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This is a multi-part message in MIME format. --------------QTZxLKsGzv0KfzQNOdYmb5qi Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, Sergey! thanks for the patch! LGTM with a minor comment below. Sergey On 3/28/26 18:31, Sergey Kaplun wrote: > diff --git a/test/tarantool-tests/lj-1403-vmevent-crash-on-stkov.test.lua b/test/tarantool-tests/lj-1403-vmevent-crash-on-stkov.test.lua > new file mode 100644 > index 00000000..ad275e17 > --- /dev/null > +++ b/test/tarantool-tests/lj-1403-vmevent-crash-on-stkov.test.lua > @@ -0,0 +1,47 @@ > +local tap = require('tap') > + > +-- The test file to demonstrate LuaJIT crash during stack overflow > +-- in the VM event handle. > +-- See also,https://github.com/LuaJIT/LuaJIT/issues/1403. > + > +local test = tap.test('lj-1403-vmevent-crash-on-stkov'):skipcond({ > + ['Test requires JIT enabled'] = not jit.status(), > +}) > + > +test:plan(1) > + > +local jit_dump = require('jit.dump') > + > +-- XXX: Some specific stack usage without a stack top check by the > +-- Lua function header. > +local t = setmetatable({}, {__newindex = pcall, __call = type}) reproduced without __call metamethod, please add a comment with explanation why it is needed > +-- luacheck: no unused > +local function prober(...) > + -- Invokes `pcall(t, t, t)`. > + t[t] = t > +end > + > +jit.opt.start('hotloop=1') > +-- Need the invocation of the VM event. > +jit_dump.start('i', '/dev/null') > + > +-- The code below causes the stack overflow in the VM event > +-- handler. The unwinding of the error breaks the JIT semantics > +-- and leads to a crash. > +local function looper() > + local r = pcall(prober) > + if not r then > + local n = 1 > + while n < 3 do > + prober(1, 2) > + n = n + 1 > + end > + end > + looper() > +end > + > +pcall(coroutine.wrap(looper)) > + > +test:ok(true, 'no crash') > + > +test:done(true) --------------QTZxLKsGzv0KfzQNOdYmb5qi Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Hi, Sergey!

thanks for the patch! LGTM with a minor comment below.

Sergey

On 3/28/26 18:31, Sergey Kaplun wrote:


<snipped>

diff --git a/test/tarantool-tests/lj-1403-vmevent-crash-on-stkov.test.lua b/test/tarantool-tests/lj-1403-vmevent-crash-on-stkov.test.lua
new file mode 100644
index 00000000..ad275e17
--- /dev/null
+++ b/test/tarantool-tests/lj-1403-vmevent-crash-on-stkov.test.lua
@@ -0,0 +1,47 @@
+local tap = require('tap')
+
+-- The test file to demonstrate LuaJIT crash during stack overflow
+-- in the VM event handle.
+-- See also, https://github.com/LuaJIT/LuaJIT/issues/1403.
+
+local test = tap.test('lj-1403-vmevent-crash-on-stkov'):skipcond({
+  ['Test requires JIT enabled'] = not jit.status(),
+})
+
+test:plan(1)
+
+local jit_dump = require('jit.dump')
+
+-- XXX: Some specific stack usage without a stack top check by the
+-- Lua function header.
+local t = setmetatable({}, {__newindex = pcall, __call = type})

reproduced without __call metamethod, please add a comment with explanation

why it is needed

+-- luacheck: no unused
+local function prober(...)
+  -- Invokes `pcall(t, t, t)`.
+  t[t] = t
+end
+
+jit.opt.start('hotloop=1')
+-- Need the invocation of the VM event.
+jit_dump.start('i', '/dev/null')
+
+-- The code below causes the stack overflow in the VM event
+-- handler. The unwinding of the error breaks the JIT semantics
+-- and leads to a crash.
+local function looper()
+  local r = pcall(prober)
+  if not r then
+    local n = 1
+    while n < 3 do
+      prober(1, 2)
+      n = n + 1
+    end
+  end
+  looper()
+end
+
+pcall(coroutine.wrap(looper))
+
+test:ok(true, 'no crash')
+
+test:done(true)
--------------QTZxLKsGzv0KfzQNOdYmb5qi--