Tarantool development patches archive
 help / color / mirror / Atom feed
From: Igor Munkin via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Kaplun <skaplun@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit 1/2] Fix lua_yield() from C hook.
Date: Sat, 1 Jul 2023 11:44:16 +0000	[thread overview]
Message-ID: <ZKARkNekMkRwv6d7@tarantool.org> (raw)
In-Reply-To: <56e13650b2f5d7536c96c01bbbee3d4c42eedf67.1687439049.git.skaplun@tarantool.org>

Sergey,

Thanks for the patch! LGTM, considering the fixes for the comments left
by Max.

On 22.06.23, Sergey Kaplun wrote:
> From: Mike Pall <mike>
> 
> Reported by Jason Carr.
> 
> (cherry picked from commit dd5032ed844c56964347c7916db66b0eb11d8091)
> 
> When we call `lua_yield()` from the C hook the additional continuation
> frame is added. This frame contains a continuation function, PC where we
> should return, thread GC object to continue, and this frame type and
> size (see details in <src/lj_frame.h>). For non-GC64 mode, when we set
> the GC thread on the Lua stack, stack top isn't incremented, so the GC
> thread overwrites the PC to return. For the GC64 mode the increment is
> missing before setting frame type and size.
> 
> This patches fixes the behaviour by adding missing slot incrementing.
> Also, it hardens the conditions of using `lj_err_throw()`, according the
> availability of external unwinder.
> 
> The behaviour for the GC64 mode is still wrong due to miscalculation of
> the slot of the GC thread object. This will be fixed in the next
> commit.
> 
> Sergey Kaplun:
> * added the description and the test for the problem
> 
> Part of tarantool/tarantool#8516
> ---
>  src/lj_api.c                                  |  5 +-
>  .../fix-yield-c-hook-script.lua               | 19 +++++++
>  .../tarantool-c-tests/fix-yield-c-hook.test.c | 53 +++++++++++++++++++
>  3 files changed, 75 insertions(+), 2 deletions(-)
>  create mode 100644 test/tarantool-c-tests/fix-yield-c-hook-script.lua
>  create mode 100644 test/tarantool-c-tests/fix-yield-c-hook.test.c
> 

<snipped>

> -- 
> 2.34.1
> 

-- 
Best regards,
IM

  parent reply	other threads:[~2023-07-01 11:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-22 14:29 [Tarantool-patches] [PATCH luajit 0/2] Fix lua_yield from the " Sergey Kaplun via Tarantool-patches
2023-06-22 14:29 ` [Tarantool-patches] [PATCH luajit 1/2] Fix lua_yield() from " Sergey Kaplun via Tarantool-patches
2023-06-29  8:44   ` Maxim Kokryashkin via Tarantool-patches
2023-06-29 11:11     ` Sergey Kaplun via Tarantool-patches
2023-06-29 22:27       ` Maxim Kokryashkin via Tarantool-patches
2023-07-01 11:44   ` Igor Munkin via Tarantool-patches [this message]
2023-06-22 14:29 ` [Tarantool-patches] [PATCH luajit 2/2] Another fix for " Sergey Kaplun via Tarantool-patches
2023-06-29  9:09   ` Maxim Kokryashkin via Tarantool-patches
2023-06-29 11:21     ` Sergey Kaplun via Tarantool-patches
2023-06-29 22:28       ` Maxim Kokryashkin via Tarantool-patches
2023-07-01 12:09   ` Igor Munkin via Tarantool-patches
2023-07-04 17:10 ` [Tarantool-patches] [PATCH luajit 0/2] Fix lua_yield from the " Igor Munkin via Tarantool-patches

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=ZKARkNekMkRwv6d7@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imun@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit 1/2] Fix lua_yield() from C hook.' \
    /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