Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: tarantool-patches@dev.tarantool.org,
	Sergey Kaplun <skaplun@tarantool.org>
Subject: [Tarantool-patches] [PATCH luajit 1/3] MIPS64: Fix xpcall() error case.
Date: Wed, 10 Dec 2025 10:23:27 +0300	[thread overview]
Message-ID: <501e08d75b66efe4221def8226d5b43820cc8490.1765350224.git.sergeyb@tarantool.org> (raw)
In-Reply-To: <cover.1765350224.git.sergeyb@tarantool.org>

From: Mike Pall <mike>

Thanks to François Perrad and Stefan Pejic.

(cherry picked from commit ea7071d3c30b6432bfe6f8a9d263e0285cec25e3)

The patch fixes `xpcall()` segfaults on MIPS64 commit. The similar
patch for ARM64 has been backported previously, see the commit
af889e4608e6eca495dd85e6161d8bcd7d3628e6 ("ARM64: Fix xpcall()
error case (really).").

Sergey Bronnikov:
* added the description

Part of tarantool/tarantool#12134
---
 src/vm_mips64.dasc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/vm_mips64.dasc b/src/vm_mips64.dasc
index 44fba36c..da187a7a 100644
--- a/src/vm_mips64.dasc
+++ b/src/vm_mips64.dasc
@@ -1440,15 +1440,16 @@ static void build_subroutines(BuildCtx *ctx)
   |.  nop
   |
   |.ffunc xpcall
-  |  daddiu NARGS8:RC, NARGS8:RC, -16
+  |  daddiu NARGS8:TMP0, NARGS8:RC, -16
   |  ld CARG1, 0(BASE)
   |   ld CARG2, 8(BASE)
-  |    bltz NARGS8:RC, ->fff_fallback
+  |    bltz NARGS8:TMP0, ->fff_fallback
   |.    lbu TMP1, DISPATCH_GL(hookmask)(DISPATCH)
   |  gettp AT, CARG2
   |  daddiu AT, AT, -LJ_TFUNC
   |  bnez AT, ->fff_fallback		// Traceback must be a function.
   |.   move TMP2, BASE
+  |  move NARGS8:RC, NARGS8:TMP0
   |   daddiu BASE, BASE, 24
   |  // Remember active hook before pcall.
   |  srl TMP3, TMP3, HOOK_ACTIVE_SHIFT
-- 
2.43.0


  reply	other threads:[~2025-12-10  7:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-10  7:23 [Tarantool-patches] [PATCH luajit 0/3][v2] Fix stack overflow in pcall/xpcall Sergey Bronnikov via Tarantool-patches
2025-12-10  7:23 ` Sergey Bronnikov via Tarantool-patches [this message]
2025-12-10  7:23 ` [Tarantool-patches] [PATCH luajit 2/3][v2] LJ_FR2: Fix stack checks in vararg calls Sergey Bronnikov via Tarantool-patches
2025-12-10  7:23 ` [Tarantool-patches] [PATCH luajit 3/3][v2] Add stack check to pcall/xpcall Sergey Bronnikov 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=501e08d75b66efe4221def8226d5b43820cc8490.1765350224.git.sergeyb@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=estetus@gmail.com \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit 1/3] MIPS64: Fix xpcall() error case.' \
    /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