Tarantool development patches archive
 help / color / mirror / Atom feed
From: Igor Munkin via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Maksim Kokryashkin <max.kokryashkin@gmail.com>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit] sysprof: disable runtime host symtab updates
Date: Thu, 15 Feb 2024 13:40:32 +0000	[thread overview]
Message-ID: <Zc4UUEFehc6o7qH5@tarantool.org> (raw)
In-Reply-To: <20231208061023.89512-1-max.kokryashkin@gmail.com>

Max,

I've checked the patchset into all long-term branches in
tarantool/luajit and bumped a new version in master, release/3.0 and
release/2.11.

On 08.12.23, Maksim Kokryashkin via Tarantool-patches wrote:
> From: Maxim Kokryashkin <m.kokryashkin@tarantool.org>
> 
> The symtab update for newly loaded shared libraries requires
> memory allocation, which is not signal-safe and can cause
> crashes. Updating symtab in a VM hook is not a viable option
> either, as there are no guarantees that the symbol will be
> dumped before its address is streamed. This patch completely
> disables the runtime updates of the symtab for host symbols.
> That means all Lua-C modules, FFI modules, and shared libraries
> must be loaded before starting the profiler.
> 
> There is no test along with the patch for two main reasons:
> 1. The signal should land on an instruction inside the allocator
> such that the second allocator call would cause a crash because of
> an inconsistent inner state. Although we have ptrace-based
> machinery for testing, the control is not that fine-grained. The
> only option we have left is to rely on empirical offsets, which
> is not a robust solution. Moreover, it is possible to build LuaJIT
> with `malloc` as an allocator, and the test should be adapted to
> that too. Needless to say, malloc sources may differ from
> platform to platform, making the test unreliable.
> 
> 2. Regression is unlikely here since this patch removes the only
> call that could allocate memory inside the signal handler.
> 
> Resolves tarantool/tarantool#8140
> ---
> Branch: https://github.com/tarantool/luajit/tree/fckxorg/gh-8140-crash-in-allocator
> Issue: https://github.com/tarantool/tarantool/issues/8140
> PR: https://github.com/tarantool/tarantool/pull/9460
> 
>  src/lj_sysprof.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 

<snipped>

> -- 
> 2.39.3 (Apple Git-145)
> 

-- 
Best regards,
IM

      parent reply	other threads:[~2024-02-15 13:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-08  6:10 Maksim Kokryashkin via Tarantool-patches
2023-12-12  9:46 ` Sergey Kaplun via Tarantool-patches
2023-12-29 13:05 ` Sergey Bronnikov via Tarantool-patches
2024-02-15 13:40 ` Igor Munkin via Tarantool-patches [this message]

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=Zc4UUEFehc6o7qH5@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imun@tarantool.org \
    --cc=max.kokryashkin@gmail.com \
    --subject='Re: [Tarantool-patches] [PATCH luajit] sysprof: disable runtime host symtab updates' \
    /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