🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #4777

Bug#1154194: luajit: expressions with errors crash on riscv64 instead of producing errors

#4777
From: Sebastian Ramacher
Date: Mon, 16 Nov 2026 21:40
80 lines
5497 bytes
Package: luajit
Version: 2.1.0+openresty20251030-1
Severity: important
X-Debbugs-Cc: debian-riscv@lists.debian.org, sramacher@debian.org
User: debian-riscv@lists.debian.org
Usertags: riscv64

Dear maintainer,

while debugging a autopkgtest regression in python-mpv after switching
mpv to luajit, I tried to run some commands with luajit directly to
identify the issue. At some point I came across a comment on Github

https://github.com/LuaJIT/LuaJIT/pull/1267#issuecomment-2495376529

And indeed, luajit -e 'print(pcall(pcall))' on riscv64 causes a
SIGSEGV. On amd64 it produces:

$ luajit -e 'print(pcall(pcall))'
false   bad argument #1 to '?' (value expected)

From gdb on ricci.d.o/riscv64:

Starting program: /usr/bin/luajit -e print\(pcall\(pcall\)\)
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/riscv64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
lj_err_callermsg (L=L@entry=0x3ff7d88380, msg=0x3ff7d8a7b8 "bad argument #1 to '?' (value expected)") at ./src/lj_err.c:1022
warning: 1022   ./src/lj_err.c: No such file or directory
(gdb) bt
#0  lj_err_callermsg (L=L@entry=0x3ff7d88380, msg=0x3ff7d8a7b8 "bad argument #1 to '?' (value expected)") at ./src/lj_err.c:1022
#1  0x0000002aaaadf7ae in err_argmsg (L=0x3ff7d88380, narg=<optimized out>, narg@entry=1, msg=<optimized out>) at ./src/lj_err.c:1074
#2  0x0000002aaaadf7e0 in lj_err_arg (L=<optimized out>, narg=narg@entry=1, em=em@entry=LJ_ERR_NOVAL) at ./src/lj_err.c:1091
#3  0x0000002aaaae04a8 in lj_lib_checkany (L=<optimized out>, narg=1) at ./src/lj_lib.c:192
#4  lj_ffh_pcall (L=<optimized out>) at ./src/lib_base.c:357
#5  0x0000002aaab0c154 in lj_fff_fallback () at ./src/buildvm_riscv.dasc:2931
#6  0x0000002aaaafd304 in lua_pcall (L=L@entry=0x3ff7d88380, nargs=nargs@entry=0, nresults=nresults@entry=0, errfunc=errfunc@entry=2) at ./src/lj_api.c:1151
#7  0x0000002aaaab24b0 in docall (L=L@entry=0x3ff7d88380, narg=narg@entry=0, clear=clear@entry=1) at ./src/luajit.c:137
#8  0x0000002aaaab2742 in dostring (L=L@entry=0x3ff7d88380, s=0x3ffffffe33 "print(pcall(pcall))", name=name@entry=0x2aaab0cfb0 "=(command line)")
    at ./src/luajit.c:191
#9  0x0000002aaaab2c96 in runargs (L=<optimized out>, argv=<optimized out>, argn=<optimized out>) at ./src/luajit.c:473
#10 pmain (L=0x3ff7d88380) at ./src/luajit.c:560
#11 0x0000002aaab0a05c in lj_BC_FUNCC () at ./src/buildvm_riscv.dasc:1279
#12 0x0000002aaaafd428 in lua_cpcall (L=L@entry=0x3ff7d88380, func=func@entry=0x2aaaab2906 <pmain>, ud=ud@entry=0x0) at ./src/lj_api.c:1179
#13 0x0000002aaaab1fe6 in main (argc=3, argv=0x3ffffffb78) at ./src/luajit.c:595

I am not sure if this is anyway related to the issue I was debugging in
mpv, but I think it would be good to have it fixed anway.

Cheers

(data below is from reporting reportbug on my amd64 machine, so s not
reall helpful)

-- System Information:
Debian Release: forky/sid
  APT prefers unstable-debug
  APT policy: (650, 'unstable-debug'), (650, 'unstable'), (601, 'testing'), (600, 'experimental-debug'), (600, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.17.13+deb14-amd64 (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages luajit depends on:
ii  libc6                 2.43-7
ii  libgcc-s1             16.2.0-4
ii  libluajit-5.1-2       2.1.0+openresty20251030-1+b2
ii  libluajit-5.1-common  2.1.0+openresty20251030-1

luajit recommends no packages.

luajit suggests no packages.

-- 
Sebastian Ramacher
Technical Details
Message-ID: <O0cAF-ckn6-7@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!bofh.it!news.nic.it!robomod

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!bofh.it!news.nic.it!robomod
From: Sebastian Ramacher <sramacher@debian.org>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1154194: luajit: expressions with errors crash on riscv64 instead of producing errors
Date: Mon, 16 Nov 2026 22:40:01 +0100
Message-ID: <O0cAF-ckn6-7@gated-at.bofh.it>
X-Original-To: Debian Bug Tracking System <submit@bugs.debian.org>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Mon Nov 16 21:31:08 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.7
Reply-To: Sebastian Ramacher <sramacher@debian.org>, 1154194@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: debian-riscv@lists.debian.org, sramacher@debian.org, pkg-lua-devel@lists.alioth.debian.org
X-Debian-Pr-Message: report 1154194
X-Debian-Pr-Package: luajit
X-Debian-Pr-Source: luajit
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
X-Reportbug-Version: 13.2.0+nmu1
X-Debian-User: sramacher
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2003051
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 80
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Mon, 16 Nov 2026 22:28:13 +0100
X-Original-Message-ID: <avt1bcyu6ANS39Du@ramacher.at>