Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Kaplun <skaplun@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit 1/2] Run VM events and finalizers in separate state.
Date: Mon, 30 Mar 2026 10:58:43 +0300	[thread overview]
Message-ID: <9c87e62e-b75e-4713-be59-c6036eb9fc4b@tarantool.org> (raw)
In-Reply-To: <7c96f2917ce5525a7799a1f327e0981d9a59f84f.1774711616.git.skaplun@tarantool.org>

[-- Attachment #1: Type: text/plain, Size: 1756 bytes --]

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)

[-- Attachment #2: Type: text/html, Size: 2478 bytes --]

  reply	other threads:[~2026-03-30  7:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-28 15:31 [Tarantool-patches] [PATCH luajit 0/2] " Sergey Kaplun via Tarantool-patches
2026-03-28 15:31 ` [Tarantool-patches] [PATCH luajit 1/2] Run " Sergey Kaplun via Tarantool-patches
2026-03-30  7:58   ` Sergey Bronnikov via Tarantool-patches [this message]
2026-03-30  9:38     ` Sergey Kaplun via Tarantool-patches
2026-03-30 11:06       ` Sergey Bronnikov via Tarantool-patches
2026-03-28 15:31 ` [Tarantool-patches] [PATCH luajit 2/2] Fix VM event error handling for finalizers Sergey Kaplun via Tarantool-patches
2026-03-30  8:08   ` Sergey Bronnikov via Tarantool-patches
2026-03-30  9:44     ` Sergey Kaplun via Tarantool-patches
2026-03-30 11:07       ` Sergey Bronnikov via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9c87e62e-b75e-4713-be59-c6036eb9fc4b@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=sergeyb@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit 1/2] Run VM events and finalizers in separate state.' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox