Tarantool development patches archive
 help / color / mirror / Atom feed
From: Igor Munkin <imun@tarantool.org>
To: Kirill Yukhin <kyukhin@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org,
	Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH v2 luajit 0/3] Trace abort on FFI sandwich or mode change
Date: Sun, 19 Apr 2020 23:16:48 +0300	[thread overview]
Message-ID: <20200419201648.GT8314@tarantool.org> (raw)
In-Reply-To: <cover.1586906667.git.imun@tarantool.org>

Kirill,

I have no idea what's wrong with Travis, but Gitlab CI is green. Please
proceed with the series.

On 15.04.20, Igor Munkin wrote:
> This series closes two issues related to the JIT machinery behaviour:
> * "FFI sandwich"(*) detection is introduced. If sandwich is detected
>   while trace recording the recording is aborted. The sandwich detected
>   while mcode execution leads to the platform panic.
> * luaJIT_setmode call is prohibited while mcode execution and leads to
>   the platform panic.
> 
> (*) The following stack mix is called FFI sandwich.
>     | Lua-FFI -> C routine -> Lua-C API -> Lua VM
>     This sort of re-entrancy is explicitly not supported by LuaJIT
>     compiler. For more info see [1].
> 
> Furthermore, this series also provides an aixillary module for LuaJIT
> testing machinery.
> 
> [1]: https://github.com/tarantool/tarantool/issues/4427
> 
> @ChangeLog:
> * "FFI sandwich"(*) detection is introduced. If sandwich is detected
>   while trace recording the recording is aborted. The sandwich detected
>   while mcode execution leads to the platform panic.
> * luaJIT_setmode call is prohibited while mcode execution and leads to
>   the platform panic.
> 
> (*) The following stack mix is called FFI sandwich.
>     | Lua-FFI -> C routine -> Lua-C API -> Lua VM
>     This sort of re-entrancy is explicitly not supported by LuaJIT
>     compiler. For more info see gh-4427.
> 
> Branch: https://github.com/tarantool/luajit/tree/imun/ffi-sandwich
> 
> Changes in v2:
> * Adjusted naming and commit message considering Sergos' comments.
> * Reworked tests considering Vlad's comments.
> * Fixed VM re-entry via lua_cpcall (many thanks to Vlad's preciseness).
> 
> Igor Munkin (3):
>   test: add auxillary module for testing
>   jit: abort trace recording and execution for C API
>   jit: abort trace execution on JIT mode change
> 
>  src/lj_api.c                             | 44 ++++++++++++++----
>  src/lj_dispatch.c                        |  6 +++
>  src/lj_errmsg.h                          |  2 +
>  test/gh-4427-ffi-sandwich.skipcond       |  7 +++
>  test/gh-4427-ffi-sandwich.test.lua       | 49 ++++++++++++++++++++
>  test/gh-4427-ffi-sandwich/CMakeLists.txt |  1 +
>  test/gh-4427-ffi-sandwich/libsandwich.c  | 59 ++++++++++++++++++++++++
>  test/lj-flush-on-trace.skipcond          |  7 +++
>  test/lj-flush-on-trace.test.lua          | 48 +++++++++++++++++++
>  test/lj-flush-on-trace/CMakeLists.txt    |  1 +
>  test/lj-flush-on-trace/libflush.c        | 31 +++++++++++++
>  test/suite.ini                           |  1 +
>  test/utils.lua                           | 33 +++++++++++++
>  13 files changed, 280 insertions(+), 9 deletions(-)
>  create mode 100644 test/gh-4427-ffi-sandwich.skipcond
>  create mode 100755 test/gh-4427-ffi-sandwich.test.lua
>  create mode 100644 test/gh-4427-ffi-sandwich/CMakeLists.txt
>  create mode 100644 test/gh-4427-ffi-sandwich/libsandwich.c
>  create mode 100644 test/lj-flush-on-trace.skipcond
>  create mode 100755 test/lj-flush-on-trace.test.lua
>  create mode 100644 test/lj-flush-on-trace/CMakeLists.txt
>  create mode 100644 test/lj-flush-on-trace/libflush.c
>  create mode 100644 test/utils.lua
> 
> -- 
> 2.25.0
> 

-- 
Best regards,
IM

  parent reply	other threads:[~2020-04-19 20:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-15  0:34 Igor Munkin
2020-04-15  0:34 ` [Tarantool-patches] [PATCH v2 luajit 1/3] test: add auxillary module for testing Igor Munkin
2020-04-15  0:34 ` [Tarantool-patches] [PATCH v2 luajit 2/3] jit: abort trace recording and execution for C API Igor Munkin
2020-04-15  0:34 ` [Tarantool-patches] [PATCH v2 luajit 3/3] jit: abort trace execution on JIT mode change Igor Munkin
2020-04-19 16:16 ` [Tarantool-patches] [PATCH v2 luajit 0/3] Trace abort on FFI sandwich or " Vladislav Shpilevoy
2020-04-19 17:51   ` Igor Munkin
2020-04-19 20:16 ` Igor Munkin [this message]
2020-04-20  7:09 ` Kirill Yukhin

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=20200419201648.GT8314@tarantool.org \
    --to=imun@tarantool.org \
    --cc=kyukhin@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 luajit 0/3] Trace abort on FFI sandwich or mode change' \
    /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