From: Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Kaplun <skaplun@tarantool.org>
Cc: Sergey Bronnikov <estetus@gmail.com>,
tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit 2/3][v2] LJ_FR2: Fix stack checks in vararg calls.
Date: Thu, 12 Mar 2026 09:52:11 +0300 [thread overview]
Message-ID: <86ecb5ef-9041-40b5-a53d-1921c9a07076@tarantool.org> (raw)
In-Reply-To: <aagAGsrJaS6BHtiH@root>
[-- Attachment #1: Type: text/plain, Size: 2737 bytes --]
Hi, Sergey,
see the answer below
Sergey
On 3/4/26 12:49, Sergey Kaplun wrote:
> Sergey,
>
> On 16.02.26, Sergey Bronnikov wrote:
>> Hi, Sergey,
>>
>> thanks for review!
>>
>> On 2/11/26 11:30, Sergey Kaplun via Tarantool-patches wrote:
>>> On 10.12.25, Sergey Bronnikov wrote:
> <snipped>
>
>>>> diff --git a/src/lj_dispatch.c b/src/lj_dispatch.c
>>>> index a44a5adf..431cb3c2 100644
>>>> --- a/src/lj_dispatch.c
>>>> +++ b/src/lj_dispatch.c
>>>> @@ -453,7 +453,7 @@ static int call_init(lua_State *L, GCfunc *fn)
>>>> int numparams = pt->numparams;
>>>> int gotparams = (int)(L->top - L->base);
>>>> int need = pt->framesize;
>>>> - if ((pt->flags & PROTO_VARARG)) need += 1+gotparams;
>>>> + if ((pt->flags & PROTO_VARARG)) need += 1+LJ_FR2+gotparams;
>>>> lj_state_checkstack(L, (MSize)need);
>>>> numparams -= gotparams;
>>>> return numparams >= 0 ? numparams : 0;
>>> Let's add an additional test for this part of code (since we don't have
>>> any). It may be taken from [1]. It doesn't fail now, but we may cover
>>> this branch more precise.
>> Don't get what do you mean.
>>
>> true branch in gc32 is covered by the following tests:
>>
>> test/LuaJIT-tests
>> test/PUC-Rio-Lua-5.1-tests
>> test/tarantool-c-tests/lj-1087-vm-handler-call.c_test
>> test/tarantool-tests/fix-ff-select-recording.test.lua
>> test/tarantool-tests/fix-mips64-spare-side-exit-patching.test.lua
>> test/tarantool-tests/fix-slot-check-for-mm-record.test.lua
>> test/tarantool-tests/fix-slots-overflow-for-varg-record.test.lua
>> test/tarantool-tests/gh-6098-fix-side-exit-patching-on-arm64.test.lua
>> test/tarantool-tests/lj-1024-varg-maxslot.test.lua
>> test/tarantool-tests/lj-1025-tsetm-maxslot.test.lua
>> test/tarantool-tests/lj-1026-arm64-invalid-hrefk-offset-check.test.lua
>> test/tarantool-tests/lj-1046-fix-bc-varg-recording.test.lua
>> test/tarantool-tests/lj-1164-record-meta-concat-varg-pcall.test.lua
>> test/tarantool-tests/lj-1295-bad-renames-for-sunk-values.test.lua
>> test/tarantool-tests/lj-584-bad-renames-for-sunk-values.test.lua
>> test/tarantool-tests/lj-704-bc-varg-use-def.test.lua
> Just the true branch isn't enough. We need the true branch when the
> stack needs to be reallocated, like in the [1]. When I check this issue
> (with 1 removed) none of our tests catches the incorrect behaviour. You
> may refer to the test like lj-1402-vararg-realloc-check.test.lua. The
> comment in the test should clarify that this is to avoid regressions in
> the future.
A new file with test was added (see
test/tarantool-tests/gh-1402-call_init-regression.test.lua).
The branch was force-pushed.
> <snipped>
>
>>> [1]:https://github.com/LuaJIT/LuaJIT/issues/1402#issue-3569942423
>>>
[-- Attachment #2: Type: text/html, Size: 4118 bytes --]
next prev parent reply other threads:[~2026-03-12 6:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-10 7:23 [Tarantool-patches] [PATCH luajit 0/3][v2] Fix stack overflow in pcall/xpcall Sergey Bronnikov via Tarantool-patches
2025-12-10 7:23 ` [Tarantool-patches] [PATCH luajit 1/3] MIPS64: Fix xpcall() error case Sergey Bronnikov via Tarantool-patches
2026-02-11 7:17 ` Sergey Kaplun via Tarantool-patches
2026-02-12 13:26 ` Sergey Bronnikov via Tarantool-patches
2025-12-10 7:23 ` [Tarantool-patches] [PATCH luajit 2/3][v2] LJ_FR2: Fix stack checks in vararg calls Sergey Bronnikov via Tarantool-patches
2026-02-11 8:30 ` Sergey Kaplun via Tarantool-patches
2026-02-16 7:20 ` Sergey Bronnikov via Tarantool-patches
2026-03-04 9:49 ` Sergey Kaplun via Tarantool-patches
2026-03-12 6:52 ` Sergey Bronnikov via Tarantool-patches [this message]
2025-12-10 7:23 ` [Tarantool-patches] [PATCH luajit 3/3][v2] Add stack check to pcall/xpcall Sergey Bronnikov via Tarantool-patches
2026-02-11 10:24 ` Sergey Kaplun via Tarantool-patches
2026-03-11 14:37 ` 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=86ecb5ef-9041-40b5-a53d-1921c9a07076@tarantool.org \
--to=tarantool-patches@dev.tarantool.org \
--cc=estetus@gmail.com \
--cc=sergeyb@tarantool.org \
--cc=skaplun@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH luajit 2/3][v2] LJ_FR2: Fix stack checks in vararg calls.' \
/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