From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp58.i.mail.ru (smtp58.i.mail.ru [217.69.128.38]) (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 CF2484429E1 for ; Thu, 18 Jun 2020 00:07:41 +0300 (MSK) From: Alexander Turenko Date: Thu, 18 Jun 2020 00:06:48 +0300 Message-Id: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v2 0/3] Merger's NULL defererence List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy , Igor Munkin Cc: tarantool-patches@dev.tarantool.org, Alexander Turenko Differences from v1 ------------------- - Added the patch to don't leave garbage on a reusable Lua stack (2.5th patch in v1 series). - Dropped the patch, which trims luaL_ prefix from next() and destroy() implementations (1st patch in v1 series). - [minor] Drop redundant `struct tuple;` definition from a test. - [minor] Make `luacheck -r` happy with gh-4954-merger-via-c.test.lua. - [minor] Small wording and formatting fixes. See the v1 series for more detailed description of changes and the related discussions: https://lists.tarantool.org/pipermail/tarantool-patches/2020-June/017325.html Overview of the patchset ------------------------ The first patch just fixes NULL pointer dereference that occurs due to the wrong assumption: I did think that fiber().storage.lua.stack is always exists and non-NULL. The second patch fix merge sources to don't leave any garbage on a reusable Lua stack (it may matter if we'll use a merge source from C code). The third commit is the optimization: it allows to don't create a new Lua state in merger when possible. Changelog entry --------------- @ChangeLog - merger: fix NULL pointer dereference when merger is called via the binary protocol (say, via net.box) (gh-4954) Links ----- https://github.com/tarantool/tarantool/issues/4954 Totktonada/gh-4954-fix-merger-segfault-full-ci ---- Alexander Turenko (3): merger: fix NULL dereference when called via iproto merger: clean fiber-local Lua stack after next() lua: expose temporary Lua state for iproto calls src/box/lua/call.c | 27 ++ src/box/lua/merger.c | 200 ++++++++++++-- src/lib/core/fiber.h | 14 +- test/CMakeLists.txt | 1 + test/box-tap/CMakeLists.txt | 4 + test/box-tap/check_merge_source.c | 108 ++++++++ test/box-tap/gh-4954-merger-via-c.test.lua | 251 ++++++++++++++++++ .../gh-4954-merger-via-net-box.test.lua | 129 +++++++++ 8 files changed, 708 insertions(+), 26 deletions(-) create mode 100644 test/box-tap/CMakeLists.txt create mode 100644 test/box-tap/check_merge_source.c create mode 100755 test/box-tap/gh-4954-merger-via-c.test.lua create mode 100755 test/box-tap/gh-4954-merger-via-net-box.test.lua -- 2.25.0