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 BCB0F26510D; Thu, 16 Feb 2023 14:40:22 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org BCB0F26510D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1676547622; bh=iz1GeIviPj3jCCdWmLwtTKy3T5XgK60mTf78i6TW4L8=; 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=yWlBO9p4X+lZfiHRr/BH0GFi9t6cqqtuK7LuFUTrRlS1DJkGxTaGmkjQ6WTcEzCfV v0JV3JZT0Dg5jpsqqU0Rmpod9lri7j/R+7vC+mZh2F6LYXamzBvSy15RoAnxdZrcyI UJU47FmeRKvp+qkrk815FRFUb9muoP5e23LFydks= Received: from smtpng3.i.mail.ru (smtpng3.i.mail.ru [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 9B607264379 for ; Thu, 16 Feb 2023 14:40:21 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 9B607264379 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1pScce-0007Vg-Ia; Thu, 16 Feb 2023 14:40:21 +0300 Date: Thu, 16 Feb 2023 14:36:47 +0300 To: Maxim Kokryashkin Message-ID: References: <870c8aef7cc4ce720197122490cb5bf78913c4c3.1676413474.git.m.kokryashkin@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <870c8aef7cc4ce720197122490cb5bf78913c4c3.1676413474.git.m.kokryashkin@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD94A31EA4B0797EF2EBEF8AA50000CB2E0FF25F7F485B287F1182A05F5380850404C228DA9ACA6FE27065285F7758CFFB0EFEC7421906E72A72E3D1E5DAC8203B18FB3B1E6D02540E7 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE73A0E02362971E860EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637E1AAA91777E61F958638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D84A7E6D42B945FD501BA70D800004C16E117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCDCBA8CBAA3833548A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F4460429728776938767073520437C869540D2AB0F6FD1C55BDD38FC3FD2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6A45692FFBBD75A6A089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-B7AD71C0: 4965CFDFE0519134C1FE400A9E48C5401DD40DE57556AFB266D16FC5F53507A1816E0A2A8F779BBED8D40077074E805C66D16FC5F53507A117535B0CF9F6D0C3EE9D5CB6078CC77CA27A45B93F36DCA30D10BAB907AB3466 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34324A9840C798D50072CB81708557E9D1357C1793A0C0ADFE5FE21F81E0DB758047C175E0F0AF2D8B1D7E09C32AA3244CEEC893672B06727CF9454421C1729FACE3D93501275E802FFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojohRiI5imL4/VEG0O+H/lFw== X-DA7885C5: 3A4E6AA237FCDF24C77190E58E7F2BE8BB29CAD1423A3A6934F64A555EB22A10262E2D401490A4A0DB037EFA58388B346E8BC1A9835FDE71 X-Mailru-Sender: 689FA8AB762F73933AF1F914F131DBF50DEA0B6646926F837D529A31130580840FBE9A32752B8C9C2AA642CC12EC09F1FB559BB5D741EB962F61BD320559CF1EFD657A8799238ED55FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 2/5] Handle on-trace OOM errors from helper functions. 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 Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Maxim! Thanks for the patch! It's really well described and generally LGTM, but I still have some more minor questions and comments. On 15.02.23, Maxim Kokryashkin wrote: > From: Mike Pall > > (cherry-picked from commit 4bba29e697d00df5f020e76c2003bb9ce51c5d38) > > This patch introduces handling of errors from internal helper > functions on traces. FFI C++ exception interoperability is > not yet implemented. > > For each throwing trace, its mcode entry is augmented with a > DWARF2 frame description entry. After that, a dynamic DWARF2 Minor: Common information entry and frame description entry. > frame info is registered based on that entry with > `__register_frame()`. Because the ARM32 architecture lacks Is there any documentation links for this function (I see only something like: "document me!")? If not, may you please describe it shortly? > the __register_frame, unwinding is not supported on it. > > For each throwing function call, a snapshot is allocated. > When we have a parent trace, our side trace head requires > additional snapshot allocation, so the additional Typo: s/additional/an additional/ > `asm_snap_prev()` call is added. > > Unwinding on traces is disabled on Darwin, due to quirks of > Apple's version of libunwind. I don't see those changes, what are you talking about? > > Maxim Kokryashkin: > * added the description and the test for the problem > > Part of tarantool/tarantool#7745 I suggest to add here: | Part of tarantool/tarantool#8069 Also, it will be nice to describe new fields in structures (`asm_State`, `SnapShot`) introduced by Mike. Also, please mention what registers are chosen as EHRAREG (you can use a bullet list with arches, numbers and names of registers). Also, is good to mention why do we now need snapshots right after each `pcall()` and `xpcall()` frame. > --- > doc/status.html | 7 - > src/lj_arch.h | 12 + > src/lj_asm.c | 77 ++++- > src/lj_dispatch.h | 4 +- > src/lj_err.c | 274 +++++++++++++++++- > src/lj_err.h | 19 +- > src/lj_ffrecord.c | 2 + > src/lj_jit.h | 2 + > src/lj_mcode.c | 5 +- > src/lj_opt_loop.c | 1 + > src/lj_record.c | 3 +- > src/lj_snap.c | 1 + > src/lj_state.c | 1 + > src/lj_target_x86.h | 2 + > src/lj_trace.c | 61 +++- > src/lj_trace.h | 3 + > src/lj_vm.h | 3 + > src/vm_arm.dasc | 3 +- > src/vm_arm64.dasc | 4 +- > src/vm_mips.dasc | 9 +- > src/vm_mips64.dasc | 10 +- > src/vm_ppc.dasc | 3 +- > src/vm_x64.dasc | 6 +- > src/vm_x86.dasc | 4 +- > .../gh-7745-oom-on-trace.test.lua | 20 ++ > 25 files changed, 478 insertions(+), 58 deletions(-) > create mode 100644 test/tarantool-tests/gh-7745-oom-on-trace.test.lua > > diff --git a/doc/status.html b/doc/status.html > index c89255b6..c9cd9071 100644 > --- a/doc/status.html > +++ b/doc/status.html > diff --git a/src/lj_arch.h b/src/lj_arch.h > index 2e458d20..8643aa4a 100644 > --- a/src/lj_arch.h > +++ b/src/lj_arch.h > diff --git a/src/lj_asm.c b/src/lj_asm.c > index a154547b..adfaf286 100644 > --- a/src/lj_asm.c > +++ b/src/lj_asm.c > @@ -944,6 +946,14 @@ static void asm_snap_alloc(ASMState *as) > if (!irref_isk(ref)) { > asm_snap_alloc1(as, ref); > if (LJ_SOFTFP && (sn & SNAP_SOFTFPNUM)) { > + /* > + ** FIXME: The following assert was replaced with Minor: I'm not so sure about this heavy comment. I suggest just to use `lua_assert()` as is, it will be replaced back after backporting "Improve assertions". Feel free to ignore. > + ** the conventional `lua_assert`. > + ** > + ** lj_assertA(irt_type(IR(ref+1)->t) == IRT_SOFTFP, > + ** "snap %d[%d] points to bad SOFTFP IR %04d", > + ** snapno, n, ref - REF_BIAS); > + */ > lua_assert(irt_type(IR(ref+1)->t) == IRT_SOFTFP); > asm_snap_alloc1(as, ref+1); > } > @@ -970,19 +980,16 @@ static int asm_snap_checkrename(ASMState *as, IRRef ren) > diff --git a/src/lj_dispatch.h b/src/lj_dispatch.h > index addf5572..b8bc2594 100644 > --- a/src/lj_dispatch.h > +++ b/src/lj_dispatch.h > diff --git a/src/lj_err.c b/src/lj_err.c > index d0223384..c7fd9e65 100644 > --- a/src/lj_err.c > +++ b/src/lj_err.c > @@ -304,12 +309,59 @@ LJ_FUNCA int lj_err_unwind_win(EXCEPTION_RECORD *rec, > + > +#if LJ_UNWIND_JIT > +/* DWARF2 personality handler for JIT-compiled code. */ > +static int err_unwind_jit(int version, int actions, > + uint64_t uexclass, _Unwind_Exception *uex, _Unwind_Context *ctx) > +{ > + /* NYI: FFI C++ exception interoperability. */ > + if (version != 1 || !LJ_UEXCLASS_CHECK(uexclass)) > + return _URC_FATAL_PHASE1_ERROR; > + if ((actions & _UA_SEARCH_PHASE)) { > + return _URC_HANDLER_FOUND; > + } > + if ((actions & _UA_CLEANUP_PHASE)) { > + global_State *g = *(global_State **)(uex+1); Side note: Just get the next field of the structure, nothing to see here (cust to the whole structure is too easy way...). > + ExitNo exitno; > + uintptr_t addr = _Unwind_GetIP(ctx); /* Return address _after_ call. */ > + uintptr_t stub = lj_trace_unwind(G2J(g), addr - sizeof(MCode), &exitno); > + /* > + ** FIXME: The following assert was replaced with > + ** the conventional `lua_assert`. > + ** > + ** lj_assertG(tvref(g->jit_base), "unexpected throw across mcode frame"); > + */ > + lua_assert(tvref(g->jit_base)); > + if (stub) { /* Jump to side exit to unwind the trace. */ > + G2J(g)->exitcode = LJ_UEXCLASS_ERRCODE(uexclass); > +#ifdef LJ_TARGET_MIPS > + _Unwind_SetGR(ctx, 4, stub); > + _Unwind_SetGR(ctx, 5, exitno); > + _Unwind_SetIP(ctx, (uintptr_t)(void *)lj_vm_unwind_stub); > +#else > + _Unwind_SetIP(ctx, stub); > +#endif > + return _URC_INSTALL_CONTEXT; > + } > + return _URC_FATAL_PHASE2_ERROR; > + } > + return _URC_FATAL_PHASE1_ERROR; > +} > + > +/* DWARF2 template frame info for JIT-compiled code. > +** > +** After copying the template to the start of the mcode segment, > +** the frame handler function and the code size is patched. > +** The frame handler always installs a new context to jump to the exit, > +** so don't bother to add any unwind opcodes. > +*/ > +static const uint8_t err_frame_jit_template[] = { Side note: Still don't want to use defines (or structures:)) for all those constatns and strings... > +#if LJ_BE > + 0,0,0, > +#endif > + LJ_64 ? 0x1c : 0x14, /* CIE length. */ > +#if LJ_LE > + 0,0,0, > +#endif > + 0,0,0,0, 1, 'z','P','R',0, /* CIE mark, CIE version, augmentation. */ > + 1, LJ_64 ? 0x78 : 0x7c, LJ_TARGET_EHRAREG, /* Code/data align, RA. */ Side note: Code alignment factor is 1 (uleb128). Data alignment factor is LJ_64 ? 8 : 4 (sleb128). > +#if LJ_64 > + 10, 0, 0,0,0,0,0,0,0,0, 0x1b, /* Aug. data ABS handler, PCREL|SDATA4 code. */ Don't get this. Why do we use PCREL|SDATA4 code for 8-byte pointers (instead PCREL|SDATA8) (I mean we already reserve room for it)? What is "ABS handler"? I don't see any docs about it. > + 0,0,0,0,0, /* Alignment. */ > +#else > + 6, 0, 0,0,0,0, 0x1b, /* Aug. data ABS handler, PCREL|SDATA4 code. */ > + 0, /* Alignment. */ > +#endif > +#if LJ_BE > + 0,0,0, > +#endif > + LJ_64 ? 0x14 : 0x10, /* FDE length. */ Side note: Is differ due to "Alignment". > + 0,0,0, > + LJ_64 ? 0x24 : 0x1c, /* CIE offset. */ > + 0,0,0, > + LJ_64 ? 0x14 : 0x10, /* Code offset. After Final FDE. */ Side note: Equals to FDE length, because this entry is right before the corresponding MCode. > +#if LJ_LE > + 0,0,0, > +#endif > + 0,0,0,0, 0, 0,0,0, /* Code size, augmentation length, alignment. */ > +#if LJ_64 > + 0,0,0,0, /* Alignment. */ > +#endif > + 0,0,0,0 /* Final FDE. */ > +}; > + > +#define ERR_FRAME_JIT_OFS_HANDLER 0x12 > +#define ERR_FRAME_JIT_OFS_FDE (LJ_64 ? 0x20 : 0x18) > +#define ERR_FRAME_JIT_OFS_CODE_SIZE (LJ_64 ? 0x2c : 0x24) > +#if LJ_TARGET_OSX > +#define ERR_FRAME_JIT_OFS_REGISTER ERR_FRAME_JIT_OFS_FDE Why this field is different for macOS and Linux (macOS uses FDE start, and Linux CIE start as an argument)? Please describe it in the commit message. (May be the link to `__register_frame()` documentation is enough). > +#else > +#define ERR_FRAME_JIT_OFS_REGISTER 0 > +#endif > + > +extern void __register_frame(const void *); > +extern void __deregister_frame(const void *); > + > +uint8_t *lj_err_register_mcode(void *base, size_t sz, uint8_t *info) > +{ > + void **handler; > + memcpy(info, err_frame_jit_template, sizeof(err_frame_jit_template)); > + handler = (void *)err_unwind_jit; > + memcpy(info + ERR_FRAME_JIT_OFS_HANDLER, &handler, sizeof(handler)); > + *(uint32_t *)(info + ERR_FRAME_JIT_OFS_CODE_SIZE) = > + (uint32_t)(sz - sizeof(err_frame_jit_template) - (info - (uint8_t *)base)); > + __register_frame(info + ERR_FRAME_JIT_OFS_REGISTER); > +#ifdef LUA_USE_ASSERT > + { > + struct dwarf_eh_bases ehb; > + lj_assertX(_Unwind_Find_FDE(info + sizeof(err_frame_jit_template)+1, &ehb), > + "bad JIT unwind table registration"); > + } > +#endif > + return info + sizeof(err_frame_jit_template); > +} > + > +void lj_err_deregister_mcode(void *base, size_t sz, uint8_t *info) > +{ > + UNUSED(base); UNUSED(sz); > + __deregister_frame(info + ERR_FRAME_JIT_OFS_REGISTER); Should it be the opposite assert here? > +} > @@ -492,25 +685,68 @@ LJ_FUNCA int lj_err_unwind_arm(int state, _Unwind_Control_Block *ucb, > } > if (__gnu_unwind_frame(ucb, ctx) != _URC_OK) > return _URC_FAILURE; > +#ifdef LUA_USE_ASSERT > + /* We should never get here unless this is a forced unwind aka backtrace. */ > + if (_Unwind_GetGR(ctx, 0) == 0xff33aa77) { > + _Unwind_SetGR(ctx, 0, 0xff33aa88); > + } > +#endif > return _URC_CONTINUE_UNWIND; > } > > -#if LJ_UNWIND_EXT > -static __thread _Unwind_Control_Block static_uex; > +#if LJ_UNWIND_EXT && defined(LUA_USE_ASSERT) > +typedef int (*_Unwind_Trace_Fn)(_Unwind_Context *, void *); > +extern int _Unwind_Backtrace(_Unwind_Trace_Fn, void *); > + > +static int err_verify_bt(_Unwind_Context *ctx, int *got) > +{ > + if (_Unwind_GetGR(ctx, 0) == 0xff33aa88) { *got = 2; } > + else if (*got == 0) { *got = 1; _Unwind_SetGR(ctx, 0, 0xff33aa77); } Side note: OMG we totally, don't want to use defines with meaningfull names here, just use random constants:)... > + return _URC_OK; > +} > + > +/* Verify that external error handling actually has a chance to work. */ > +void lj_err_verify(void) > +{ > + int got = 0; > + _Unwind_Backtrace((_Unwind_Trace_Fn)err_verify_bt, &got); > + /* > + ** FIXME: The following assert was replaced with > + ** the conventional `lua_assert`. > + ** > + ** lj_assertX(got == 2, "broken build: external frame unwinding enabled, but missing -funwind-tables"); > + */ > + lua_assert(got == 2); > +} > #endif > @@ -620,7 +856,7 @@ static ptrdiff_t finderrfunc(lua_State *L) > /* Runtime error. */ > LJ_NOINLINE void LJ_FASTCALL lj_err_run(lua_State *L) > { > - ptrdiff_t ef = finderrfunc(L); > + ptrdiff_t ef = (LJ_HASJIT && tvref(G(L)->jit_base)) ? 0 : finderrfunc(L); If we don't want to find error function when we on trace why do we take `if (errcode == LUA_ERRRUN)` below? Does it mean that we will still try to rethrow error raising inside `lj_trace_exit()` (AFAICS this is the only place when `jit_base == 0` and we call `lj_err_trace()`)? If so, please mention this in the commit message. Also, please mention that `lj_err_trace()` is introduced to use instead `lj_err_run()` in rethrowing of the error. > if (ef) { > TValue *errfunc = restorestack(L, ef); > TValue *top = L->top; > @@ -639,6 +875,16 @@ LJ_NOINLINE void LJ_FASTCALL lj_err_run(lua_State *L) > lj_err_throw(L, LUA_ERRRUN); > } > > +#if LJ_HASJIT > +LJ_NOINLINE void LJ_FASTCALL lj_err_trace(lua_State *L, int errcode) > +{ > + if (errcode == LUA_ERRRUN) > + lj_err_run(L); > + else > + lj_err_throw(L, errcode); > +} > +#endif > + > /* Formatted runtime error message. */ > LJ_NORET LJ_NOINLINE static void err_msgv(lua_State *L, ErrMsg em, ...) > { > diff --git a/src/lj_err.h b/src/lj_err.h > index aa4b7e0d..b0c72c24 100644 > --- a/src/lj_err.h > +++ b/src/lj_err.h > diff --git a/src/lj_ffrecord.c b/src/lj_ffrecord.c > index 649ac705..8af9da1d 100644 > --- a/src/lj_ffrecord.c > +++ b/src/lj_ffrecord.c > diff --git a/src/lj_jit.h b/src/lj_jit.h > index d82292f8..f2ad3c6e 100644 > --- a/src/lj_jit.h > +++ b/src/lj_jit.h > diff --git a/src/lj_mcode.c b/src/lj_mcode.c > index 77035bf7..7184d3b4 100644 > --- a/src/lj_mcode.c > +++ b/src/lj_mcode.c > diff --git a/src/lj_opt_loop.c b/src/lj_opt_loop.c > index 441b8add..10613641 100644 > --- a/src/lj_opt_loop.c > +++ b/src/lj_opt_loop.c > diff --git a/src/lj_record.c b/src/lj_record.c > index 9e2e1d9e..e7dac7ac 100644 > --- a/src/lj_record.c > +++ b/src/lj_record.c > @@ -800,7 +800,7 @@ void lj_record_ret(jit_State *J, BCReg rbase, ptrdiff_t gotresults) > J->base -= cbase; > J->base[--rbase] = TREF_TRUE; /* Prepend true to results. */ > frame = frame_prevd(frame); > + J->needsnap = 1; /* Stop catching on-trace errors. */ > } > /* Return to lower frame via interpreter for unhandled cases. */ > if (J->framedepth == 0 && J->pt && bc_isret(bc_op(*J->pc)) && > @@ -2021,7 +2022,7 @@ void lj_record_ins(jit_State *J) > /* Need snapshot before recording next bytecode (e.g. after a store). */ > if (J->needsnap) { > J->needsnap = 0; > - lj_snap_purge(J); > + if (J->pt) lj_snap_purge(J); In which cases there is no prototype? > lj_snap_add(J); > J->mergesnap = 1; > } > diff --git a/src/lj_snap.c b/src/lj_snap.c > index 2f7cf80a..a8b49fcb 100644 > --- a/src/lj_snap.c > +++ b/src/lj_snap.c > diff --git a/src/lj_state.c b/src/lj_state.c > index cc6f92f1..4add3d65 100644 > --- a/src/lj_state.c > +++ b/src/lj_state.c > diff --git a/src/lj_target_x86.h b/src/lj_target_x86.h > index 194f8e70..4efb566b 100644 > --- a/src/lj_target_x86.h > +++ b/src/lj_target_x86.h > diff --git a/src/lj_trace.c b/src/lj_trace.c > index c6e2f72e..17743159 100644 > --- a/src/lj_trace.c > +++ b/src/lj_trace.c > @@ -932,4 +944,47 @@ int LJ_FASTCALL lj_trace_exit(jit_State *J, void *exptr) > } > } > > +#if LJ_UNWIND_JIT > +/* Given an mcode address determine trace exit address for unwinding. */ > +uintptr_t LJ_FASTCALL lj_trace_unwind(jit_State *J, uintptr_t addr, ExitNo *ep) > +{ > +#if EXITTRACE_VMSTATE > + TraceNo traceno = J2G(J)->vmstate; > +#else > + TraceNo traceno = trace_exit_find(J, (MCode *)addr); > +#endif Side note: Looks like we should use the same approach for our symtab dumping in profilers. > + GCtrace *T = traceref(J, traceno); > + if (T > +#if EXITTRACE_VMSTATE > + && addr >= (uintptr_t)T->mcode && addr < (uintptr_t)T->mcode + T->szmcode > +#endif > + ) { > +} > +#endif > + > #endif > diff --git a/src/lj_trace.h b/src/lj_trace.h > index 22cae741..0bfb606f 100644 > --- a/src/lj_trace.h > +++ b/src/lj_trace.h > diff --git a/src/lj_vm.h b/src/lj_vm.h > index 1cc7eed7..411caafa 100644 > --- a/src/lj_vm.h > +++ b/src/lj_vm.h > diff --git a/src/vm_arm.dasc b/src/vm_arm.dasc > index a29292f1..436a9fd7 100644 > --- a/src/vm_arm.dasc > +++ b/src/vm_arm.dasc > diff --git a/src/vm_arm64.dasc b/src/vm_arm64.dasc > index f517a808..7066b051 100644 > --- a/src/vm_arm64.dasc > +++ b/src/vm_arm64.dasc > diff --git a/src/vm_mips.dasc b/src/vm_mips.dasc > index 93c772ff..32caabf7 100644 > --- a/src/vm_mips.dasc > +++ b/src/vm_mips.dasc > diff --git a/src/vm_mips64.dasc b/src/vm_mips64.dasc > index 9a749f93..04be38f0 100644 > --- a/src/vm_mips64.dasc > +++ b/src/vm_mips64.dasc > @@ -545,6 +545,10 @@ static void build_subroutines(BuildCtx *ctx) > diff --git a/src/vm_ppc.dasc b/src/vm_ppc.dasc > index 980176a2..7ad8df37 100644 > --- a/src/vm_ppc.dasc > +++ b/src/vm_ppc.dasc > diff --git a/src/vm_x64.dasc b/src/vm_x64.dasc > index 59f117ba..27af164a 100644 > --- a/src/vm_x64.dasc > +++ b/src/vm_x64.dasc > diff --git a/src/vm_x86.dasc b/src/vm_x86.dasc > index f7ffe5d2..85807129 100644 > --- a/src/vm_x86.dasc > +++ b/src/vm_x86.dasc > diff --git a/test/tarantool-tests/gh-7745-oom-on-trace.test.lua b/test/tarantool-tests/gh-7745-oom-on-trace.test.lua > new file mode 100644 > index 00000000..1366af30 > --- /dev/null > +++ b/test/tarantool-tests/gh-7745-oom-on-trace.test.lua > @@ -0,0 +1,20 @@ > +require('utils').skipcond(jit.os == 'OSX', 'Disabled due to incorrect behavior of unwinder in tarantool_panic_handler') Line length is more than 80 symbols. > +local ffi = require('ffi') > + > +local tap = require('tap') > + > +local test = tap.test('OOM on trace') > +test:plan(1) > + > +local function memory_payload() > + local t = {} > + for i = 1, 1e10 do > + t[ffi.new("uint64_t")] = i Typo: s/"uint64_t"/'uint64_t'/ This case returns OOM, error (and may return the TABOV error). Can we check exactly TABOV error too(may be with the help of `table.new()`?)? > + end > + print(t) > +end > + > +local res = pcall(memory_payload) > +test:ok(res == false) > + > +os.exit(test:check() and 0 or 1) > -- > 2.39.0 > -- Best regards, Sergey Kaplun