From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [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 59ECB446429 for ; Sun, 29 Mar 2020 13:52:33 +0300 (MSK) Date: Sun, 29 Mar 2020 13:46:14 +0300 From: Igor Munkin Message-ID: <20200329104614.GI22874@tarantool.org> References: <6a753febbdde86642257c57f7e3a3b1700317ca3.1585304087.git.imun@tarantool.org> <20200328193618.GB328@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200328193618.GB328@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH luajit 2/2] jit: abort trace execution on JIT mode change List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Ostanevich Cc: Vladislav Shpilevoy , tarantool-patches@dev.tarantool.org Sergos, Thanks for you review! On 28.03.20, Sergey Ostanevich wrote: > Hi! > > Thanks for the patch, LGTM. > > Sergos. > > On 27 мар 13:47, Igor Munkin wrote: > > Current luaJIT_setmode implementation aborts trace recording but nothing > > prevents calling it on already compiled trace. E.g. if one conditionally > > calls an FFI function having luaJIT_setmode with LUAJIT_MODE_FLUSH mode > > underneath, the trace being executed can be purged and the return > > address is invalidated as a result (since the mcode is released). > > > > This changeset prohibits luaJIT_setmode call while mcode is being > > executed leading to platform panic if the call occurs. I reworded this section considering your comment about platform panic: ================================================================================ This changeset prohibits luaJIT_setmode call while mcode is being executed. If the call occurs the platform finishes its execution with EXIT_FAILURE code and calls panic routine prior to the exit. ================================================================================ > > Reviewed-by: Sergey Ostanevich > > Signed-off-by: Igor Munkin > > --- > > src/lj_dispatch.c | 5 +++++ > > src/lj_errmsg.h | 1 + > > test/lj-flush-on-trace/CMakeLists.txt | 1 + > > test/lj-flush-on-trace/libflush.c | 31 +++++++++++++++++++++++++++ > > test/lj-flush-on-trace/test.lua | 25 +++++++++++++++++++++ > > 5 files changed, 63 insertions(+) > > create mode 100644 test/lj-flush-on-trace/CMakeLists.txt > > create mode 100644 test/lj-flush-on-trace/libflush.c > > create mode 100644 test/lj-flush-on-trace/test.lua > > > > -- > > 2.25.0 > > -- Best regards, IM