Bug Description / 错误描述
Running an x86_64 Bun/OpenCode standalone binary through LATX on LoongArch64 can crash in the interactive TUI path.
Observed failure 1: when the full TUI is running, pressing Ctrl-C / exiting can abort inside LATX/QEMU TCG code:
ERROR:../accel/tcg/translate-all.c:1777:tb_remove_from_jmp_list: code should not be reached
Bail out! ERROR:../accel/tcg/translate-all.c:1777:tb_remove_from_jmp_list: code should not be reached
Observed failure 2: after a bad TUI exit or stale generated translation state, launching the same program with a fixed port can fail with:
not found LASX, use 128-bit vectors
Invalid value for lock: 0
Aborted (core dumped)
This appears related to LATX translated-code / parallel translation / generated cache state. Setting LATX_CLOSE_PARALLEL=1 avoids the tb_remove_from_jmp_list abort for the TUI exit path, but the translated TUI remains fragile after bad exits.
Environment Information / 环境信息
操作系统: AOSC OS 13.3.0,LoongArch64
Linux 内核版本: Linux 7.0.13-aosc-main-16k
GCC 版本: GCC 15.3.0
GLIBC 版本: glibc 2.42
LAT 版本号 / 提交 Hash: lat-x86_64 9bd2f78
Additional environment details:
- CPU: Loongson 2K3000
- Architecture:
loongarch64
- Kernel page size: 16 KiB (
getconf PAGESIZE => 16384)
- CPU features include:
lsx, lbt_x86
- CPU does not have LASX
- LATX runtime output:
not found LASX, use 128-bit vectors
lat-x86_64 9bd2f78
x86_64 userspace: AOSC emukit 20240730
Node.js on host: v24.17.0
Bun guest/runtime used by tested software: bun-linux-x64-baseline 1.3.14
Steps to Reproduce / 重现步骤
- Build LATX x86_64 on a LoongArch64 machine without LASX but with LSX + LBT_X86.
- Install AOSC
emukit so x86_64 userspace exists.
- Build or obtain an x86_64 Linux baseline Bun/OpenCode standalone executable.
- Run the OpenCode TUI through LATX:
/usr/local/bin/latx-x86_64 ./opencode-linux-x64-baseline/bin/opencode
- Wait for the TUI to draw.
- Press Ctrl-C or exit the TUI.
Observed abort:
ERROR:../accel/tcg/translate-all.c:1777:tb_remove_from_jmp_list: code should not be reached
A second related failure was observed after bad exits / stale translated state:
/usr/local/bin/latx-x86_64 ./opencode-linux-x64-baseline/bin/opencode --port 26701
Observed:
not found LASX, use 128-bit vectors
Invalid value for lock: 0
Aborted (core dumped)
Killing leftover LATX processes and clearing generated LATX cache can recover this second state:
killall -q latx-x86_64 || true
rm -f ~/.cache/latx/*opencode* ~/.cache/latx/*bun*
Software Information:
Software: OpenCode CLI
OpenCode source tag: v1.17.13
OpenCode source commit: 10c894bdeef3618f5666fb506ef7f9491bb964d8
Built target: Linux x64 baseline standalone binary
Build runtime: Bun 1.3.14, bun-linux-x64-baseline
OpenCode local build reports version: 0.0.0--202607060634
LATX command used:
/usr/local/bin/latx-x86_64 ./opencode-linux-x64-base
Expected Behavior / 预期行为
The x86_64 guest program should run and exit normally through LATX.
Specifically:
- Pressing Ctrl-C or exiting the OpenCode TUI should terminate cleanly.
- LATX should not abort in
tb_remove_from_jmp_list.
- Relaunching the same guest program with
--port should not fail with Invalid value for lock: 0.
Actual Behavior / 实际行为
The translated program can abort during TUI exit:
ERROR:../accel/tcg/translate-all.c:1777:tb_remove_from_jmp_list: code should not be reached
Bail out! ERROR:../accel/tcg/translate-all.c:1777:tb_remove_from_jmp_list: code should not be reached
After a bad exit or stale translated state, a later run can also fail with:
not found LASX, use 128-bit vectors
Invalid value for lock: 0
Aborted (core dumped)
A workaround was found for the first failure:
export LATX_CLOSE_PARALLEL=1
With that environment variable, the TUI exit path no longer triggered the tb_remove_from_jmp_list assertion in my testing.
However, the translated TUI / --port path still appears fragile after bad exits and may require clearing the generated LATX cache.
Screenshots or Logs / 截图或日志
Relevant logs:
not found LASX, use 128-bit vectors
ERROR:../accel/tcg/translate-all.c:1777:tb_remove_from_jmp_list: code should not be reached
Bail out! ERROR:../accel/tcg/translate-all.c:1777:tb_remove_from_jmp_list: code should not be reached
Severity / 严重性
Medium / 中
Additional Information / 附加信息
Notes:
- This machine has LSX and LBT_X86 but not LASX.
- LATX prints
not found LASX, use 128-bit vectors, so this is testing the LSX fallback path.
- The failure is not caused by vanilla QEMU binfmt selection; x86_64 binfmt was configured to use
/usr/local/bin/latx-x86_64.
- The string
Invalid value for lock: appears in the Bun/OpenCode executable, not in the LATX executable, but the failure state appeared only while running the x86_64 binary through LATX.
- Clearing generated LATX cache with the following command allowed the
--port launch to work again during testing:
killall -q latx-x86_64 || true
rm -f ~/.cache/latx/*opencode* ~/.cache/latx/*bun*
LATX_CLOSE_PARALLEL=1 avoided the tb_remove_from_jmp_list abort on TUI exit in testing.
Bug Description / 错误描述
Running an x86_64 Bun/OpenCode standalone binary through LATX on LoongArch64 can crash in the interactive TUI path.
Observed failure 1: when the full TUI is running, pressing Ctrl-C / exiting can abort inside LATX/QEMU TCG code:
Observed failure 2: after a bad TUI exit or stale generated translation state, launching the same program with a fixed port can fail with:
This appears related to LATX translated-code / parallel translation / generated cache state. Setting
LATX_CLOSE_PARALLEL=1avoids thetb_remove_from_jmp_listabort for the TUI exit path, but the translated TUI remains fragile after bad exits.Environment Information / 环境信息
操作系统: AOSC OS 13.3.0,LoongArch64
Linux 内核版本: Linux 7.0.13-aosc-main-16k
GCC 版本: GCC 15.3.0
GLIBC 版本: glibc 2.42
LAT 版本号 / 提交 Hash:
lat-x86_64 9bd2f78Additional environment details:
loongarch64getconf PAGESIZE=>16384)lsx,lbt_x86x86_64 userspace: AOSC
emukit 20240730Node.js on host:
v24.17.0Bun guest/runtime used by tested software:
bun-linux-x64-baseline 1.3.14Steps to Reproduce / 重现步骤
emukitso x86_64 userspace exists.Observed abort:
A second related failure was observed after bad exits / stale translated state:
Observed:
Killing leftover LATX processes and clearing generated LATX cache can recover this second state:
Software Information:
Software: OpenCode CLI
OpenCode source tag: v1.17.13
OpenCode source commit: 10c894bdeef3618f5666fb506ef7f9491bb964d8
Built target: Linux x64 baseline standalone binary
Build runtime: Bun 1.3.14, bun-linux-x64-baseline
OpenCode local build reports version: 0.0.0--202607060634
LATX command used:
Expected Behavior / 预期行为
The x86_64 guest program should run and exit normally through LATX.
Specifically:
tb_remove_from_jmp_list.--portshould not fail withInvalid value for lock: 0.Actual Behavior / 实际行为
The translated program can abort during TUI exit:
After a bad exit or stale translated state, a later run can also fail with:
A workaround was found for the first failure:
With that environment variable, the TUI exit path no longer triggered the
tb_remove_from_jmp_listassertion in my testing.However, the translated TUI /
--portpath still appears fragile after bad exits and may require clearing the generated LATX cache.Screenshots or Logs / 截图或日志
Relevant logs:
Severity / 严重性
Medium / 中
Additional Information / 附加信息
Notes:
not found LASX, use 128-bit vectors, so this is testing the LSX fallback path./usr/local/bin/latx-x86_64.Invalid value for lock:appears in the Bun/OpenCode executable, not in the LATX executable, but the failure state appeared only while running the x86_64 binary through LATX.--portlaunch to work again during testing:LATX_CLOSE_PARALLEL=1avoided the tb_remove_from_jmp_list abort on TUI exit in testing.