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 01FB85ECD63; Tue, 5 Sep 2023 13:40:24 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 01FB85ECD63 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1693910424; bh=9n7ml40CuumdTK84IiL1+wvTJ0COYTXn5TbzgTv7/sM=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=QgUQq44N8hn7wLdl2qC1cXXKyk2iCZtIUkEoD+lW+3tqayqtVu0Z4AxCuu5ipOgCA au/EmHhVL09pb1REsUojtvpQiU5TFXvYMHhxVgrOQ06ct63bIbP9sojShHJQObyv/i VswjaoNuNGfk3k3qVI+DpPfExI6CuEL63iVroq14= Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 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 D481B5DC247 for ; Tue, 5 Sep 2023 13:39:29 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D481B5DC247 Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-500cd6261fdso4123254e87.3 for ; Tue, 05 Sep 2023 03:39:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693910369; x=1694515169; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+onC1Ccv3yxpXxaZE+DCSSH3WZPZ5OHMnqzoiCKb53M=; b=cqvSM1stkt/6P7DmfW+vFxVoM5wpvpnUAXOFOczCCmfr+2iFIxqXPm8gfTw+Vb8CK4 ZLTxsSGC2vRbUmobYb/65DI7tAAxK3nKFnojbG+Iw9svztvxTZCgHZoBkDgPvly8goRB ttyTCUbi20uYvi2Gk/j9CTH24j6EmR1E8qoJcygOLBL+E0uipg+fSS9A+GRujJYzY5Kf ruPL1+taRYZFHR3K80DwgJPsSTBJnuT6HsacxLkcUswf/dXujNVypyz+Fr3mZvugHdLr K8XICUhz5CCjOI3Xk44XgRUJKZI48PzD/vqOxBYQz0tGonRQeg/uWeevSTXADYeplS2S miYA== X-Gm-Message-State: AOJu0YyRxYlQafgK9/e1utSybSA1Kp7PjigN08R/NWm5HiC3RUISZLrN VCVxhsDgISzQ8+U6ymiyAdsv0gO9SAhwIw== X-Google-Smtp-Source: AGHT+IEcjZYoaMg/azwOmP2ZU61fM91abpim39+cye8qVnuJfCYe1ooXTdaApgaQKjcb/U2uiRTSmw== X-Received: by 2002:a05:6512:3a9:b0:500:bb99:69a5 with SMTP id v9-20020a05651203a900b00500bb9969a5mr8056038lfp.43.1693910368744; Tue, 05 Sep 2023 03:39:28 -0700 (PDT) Received: from fckxorg.mail.msk ([2a00:1148:b0ba:16:a3e8:bdc1:dbed:dbc8]) by smtp.gmail.com with ESMTPSA id x25-20020ac24899000000b004fb7388360esm2258574lfc.188.2023.09.05.03.39.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Sep 2023 03:39:28 -0700 (PDT) X-Google-Original-From: Maxim Kokryashkin To: tarantool-patches@dev.tarantool.org, skaplun@tarantool.org, sergeyb@tarantool.org Date: Tue, 5 Sep 2023 13:39:15 +0300 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH luajit 2/2] Fix frame for more types of on-trace error messages. 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 Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" From: Mike Pall Thanks to Maxim Kokryashkin. (cherry-picked from commit d5bbf9cdb4c5eddc404a90bd44f077cfb3a57a90) This patch fixes the same issue with frame, as the previous one, but now for the table overflow error in the `err_msgv` function. The test for the problem uses the table of GC finalizers, although they are not required to reproduce the issue. They only used to make the test as simple as possible. Resolves tarantool/tarantool#562 Part of tarantool/tarantool#8825 --- src/lj_err.c | 4 +++ .../lj-1034-tabov-error-frame.test.lua | 27 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 test/tarantool-tests/lj-1034-tabov-error-frame.test.lua diff --git a/src/lj_err.c b/src/lj_err.c index 763746e6..46fb81ee 100644 --- a/src/lj_err.c +++ b/src/lj_err.c @@ -875,6 +875,10 @@ LJ_NORET LJ_NOINLINE static void err_msgv(lua_State *L, ErrMsg em, ...) const char *msg; va_list argp; va_start(argp, em); + if (LJ_HASJIT) { + TValue *base = tvref(G(L)->jit_base); + if (base) L->base = base; + } if (curr_funcisL(L)) L->top = curr_topL(L); msg = lj_strfmt_pushvf(L, err2msg(em), argp); va_end(argp); diff --git a/test/tarantool-tests/lj-1034-tabov-error-frame.test.lua b/test/tarantool-tests/lj-1034-tabov-error-frame.test.lua new file mode 100644 index 00000000..b7520d92 --- /dev/null +++ b/test/tarantool-tests/lj-1034-tabov-error-frame.test.lua @@ -0,0 +1,27 @@ +local tap = require('tap') +local ffi = require('ffi') +local test = tap.test('lj-1034-tabov-error-frame'):skipcond({ + ['Test requires JIT enabled'] = not jit.status(), + ['Test requires GC64 mode enabled'] = not ffi.abi('gc64'), + ['Disabled on MacOS due to #8652'] = jit.os == 'OSX', +}) + +test:plan(2) + +-- luacheck: no unused +local anchor = {} +local function on_gc(t) end + +local function test_finalizers() + local i = 1 + while true do + anchor[i] = ffi.gc(ffi.cast('void *', 0), on_gc) + i = i + 1 + end +end + +local st, err = pcall(test_finalizers) +st, err = pcall(test_finalizers) +test:ok(st == false, 'error handled successfully') +test:like(err, '^.+table overflow', 'error is table overflow') +test:done(true) -- 2.41.0