#1151837 FTBFS: on riscv64: Can't determine the arch of: 'out/Release/node'

Package:
src:nodejs
Source:
src:nodejs
Submitter:
Aurelien Jarno
Date:
2026-10-26 22:49:02 UTC
Severity:
normal
Tags:
#1151837#5
Date:
2026-10-23 19:25:10 UTC
From:
To:
Dear maintainer,

As you surely have noticed, the latest version of nodejs fails to build
on riscv64. It fails with:

| Clean up any leftover processes but don't error if found.
| ps awwx | grep Release/node | grep -v grep | cat
| Clean up any leftover processes, error if found.
| python3 tools/test.py  -p tap --logfile test.tap \
| 	--mode=release --flaky-tests-mode=dontcare \
| 	--skip-tests=parallel/test-perf-hooks-sliding-window-histogram,parallel/test-process-versions,parallel/test-cli-node-options-docs,parallel/test-config-file,parallel/test-debugger-probe-typescript,parallel/test-util-getcallsites,parallel/test-worker-eval-typescript,parallel/test-node-output-eval,parallel/test-worker-cli-options,parallel/test-worker-load-file-with-extension-other-than-js,parallel/test-node-output-sourcemaps,parallel/test-runner-output,parallel/test-runner-global-setup-teardow,parallel/test-runner-run-global-hooks,parallel/test-compile-cache-typescript-commonjs,parallel/test-compile-cache-typescript-esm,parallel/test-compile-cache-typescript-strip-miss,parallel/test-compile-cache-typescript-strip-sourcemaps,parallel/test-compile-cache-typescript-transform,parallel/test-npm-install,parallel/test-npm-version,parallel/test-release-npm,parallel/test-dns,parallel/test-net-connect-immediate-finish,parallel/test-net-better-error-messages-port-hostname,parallel/test-https-connect-address-family,parallel/test-tls-connect-address-family,parallel/test-dns-cancel-reverse-lookup,parallel/test-dns-resolveany-bad-ancount,parallel/test-child-process-stdio-overlapped,parallel/test-crypto-authenticated,parallel/test-corepack-yarn-install,parallel/test-corepack-version,test/parallel/test-util-styletext,sequential/test-force-repl,sequential/test-performance,sequential/test-watch-mode,sequential/test-watch-mode-inspect,parallel/test-process-uid-gid,parallel/test-process-initgroups,parallel/test-process-setgroups,parallel/test-process-euid-egid,parallel/test-strace-openat-openssl,parallel/test-fs-error-messages,parallel/test-cluster-bind-privileged-port,parallel/test-cluster-shared-handle-bind-privileged-port,parallel/test-debugger-preserve-breaks,parallel/test-debugger-heap-profiler,parallel/test-fs-utimes,parallel/test-fs-utimes-y2K38,parallel/test-debug-args,sequential/test-cpu-prof-dir-absolute,sequential/test-cpu-prof-exit,parallel/test-inspector-esm,parallel/test-sqlite \
| 	--arch=riscv64 --timeout=600 --flaky-tests=parallel/test-runner-output,sequential/test-tls-session-timeout,parallel/test-net-listen-after-destroying-stdin,parallel/test-process-config,parallel/test-regress-GH-746,parallel/test-stdout-close-unref,parallel/test-child-process-stdout-flush-exit,parallel/test-net-connect-options-fd,sequential/test-fs-watch,sequential/test-http2-session-timeout,sequential/test-debugger-preserve-breaks,sequential/test-debugger-exec-scope,sequential/test-worker-heapsnapshot-options,parallel/test-cluster-primary-error,parallel/test-cluster-primary-kill,sequential/test-http-server-keep-alive-timeout-slow-client-headers,parallel/test-icu-env,parallel/test-tls-ocsp-callback,sequential/test-diagnostic-dir-cpu-prof,sequential/test-cpu-prof-default,sequential/test-cpu-prof-worker-argv,sequential/test-cpu-prof-dir-and-name,sequential/test-cpu-prof-exit,sequential/test-cpu-prof-kill,sequential/test-cpu-prof-name,sequential/test-diagnostic-dir-cpu-prof,sequential/test-debugger-auto-resume,sequential/test-debugger-preserve-breaks,sequential/test-cpu-prof-dir-relative,sequential/test-cpu-prof-drained,sequential/test-worker-prof,sequential/test-vm-timeout-escape-promise-module-2,sequential/test-cpu-prof-dir-absolute,parallel/test-fetch,parallel/test-net-socket-connect-without-cb,parallel/test-runner-inspect,parallel/test-runner-output,parallel/test-tcp-wrap-listen,parallel/test-wasm-web-api,parallel/test-vm-timeout-escape-promise-module,parallel/test-crypto-sign-verify,parallel/test-freeze-intrinsics,parallel/test-repl-paste-big-data,parallel/test-snapshot-reproducible,parallel/test-tls-root-certificates,parallel/test-vm-global-non-writable-properties,parallel/test-vm-global-setter,parallel/test-vm-module-synthetic,parallel/test-vm-strict-assign,parallel/test-child-process-spawn-typeerror --shell=out/Release/node message parallel sequential
| Can't determine the arch of: 'out/Release/node'
|
| No tests to run.
| make[2]: *** [Makefile:591: test-ci-js] Error 1
| make[2]: Leaving directory '/tmp/tmp.qssLWQ2SLR.nodejs'
| make[1]: *** [debian/rules:425: override_dh_auto_test-arch] Error 1
| make[1]: Leaving directory '/build/reproducible-path/nodejs-24.22.0+dfsg+~cs24.19.2'
| make: *** [debian/rules:348: binary-arch] Error 2
| dpkg-buildpackage: error: debian/rules binary-arch subprocess failed with exit status 2

The full build log is available here:
https://buildd.debian.org/status/fetch.php?pkg=nodejs&arch=riscv64&ver=24.22.0%2Bdfsg%2B%7Ecs24.19.2-2&stamp=1792612093&raw=0

After investigation, it appears that version 24.22.0+dfsg+~cs24.19.2-2
just segfaults on start:

| $ gdb out/Release/node
| GNU gdb (Debian 18.1-3) 18.1
| Copyright (C) 2026 Free Software Foundation, Inc.
| License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
| This is free software: you are free to change and redistribute it.
| There is NO WARRANTY, to the extent permitted by law.
| Type "show copying" and "show warranty" for details.
| This GDB was configured as "riscv64-linux-gnu".
| Type "show configuration" for configuration details.
| For bug reporting instructions, please see:
| <https://www.gnu.org/software/gdb/bugs/>.
|
| +------------------------------------------------------------------------------+
| | Find the GDB manual online at:                                               |
| | http://www.gnu.org/software/gdb/documentation/.                              |
| | For help, type "help".                                                       |
| | Type "apropos word" to search for commands related to "word".                |
| +------------------------------------------------------------------------------+
|
| Reading symbols from out/Release/node...
| (gdb) run
| Starting program: /home/aurel32/nodejs/nodejs-24.22.0+dfsg+~cs24.19.2/out/Release/node
| [Thread debugging using libthread_db enabled]
| Using host libthread_db library "/usr/lib/riscv64-linux-gnu/libthread_db.so.1".
| bt
| [New Thread 0x3ff0dcff80 (LWP 454149) (id 2)]
| [New Thread 0x3febffef80 (LWP 454150) (id 3)]
| [New Thread 0x3feb7fdf80 (LWP 454151) (id 4)]
| [New Thread 0x3feaffcf80 (LWP 454152) (id 5)]
| [New Thread 0x3fea7fbf80 (LWP 454153) (id 6)]
| [New Thread 0x3ff04fef80 (LWP 454154) (id 7)]
|
| Thread 1 "MainThread" received signal SIGSEGV, Segmentation fault.
| 0x0000003ff5467fb6 in std::__atomic_base<long>::load (this=0x20000001f, __m=std::memory_order::relaxed) at /usr/include/c++/16/bits/atomic_base.h:529
| 529             return __atomic_load_n(&_M_i, int(__m));
| (gdb) bt
| #0  0x0000003ff5467fb6 in std::__atomic_base<long>::load (this=0x20000001f, __m=std::memory_order::relaxed) at /usr/include/c++/16/bits/atomic_base.h:529
| #1  std::atomic_load_explicit<long> (__a=0x20000001f, __m=std::memory_order::relaxed) at /usr/include/c++/16/atomic:1372
| #2  v8::base::Relaxed_Load (ptr=0x20000001f) at ../deps/v8/src/base/atomicops.h:347
| #3  v8::base::AsAtomicImpl<long>::Relaxed_Load<unsigned long> (addr=0x20000001f) at ../deps/v8/src/base/atomic-utils.h:87
| #4  v8::internal::TaggedField<v8::internal::SharedFunctionInfo, 32, v8::internal::V8HeapCompressionSchemeImpl<v8::internal::MainCage> >::Relaxed_Load (cage_base=..., host=..., offset=0) at ../deps/v8/src/objects/tagged-field-inl.h:272
| #5  v8::internal::JSFunction::shared (this=<optimized out>, cage_base=...) at ../deps/v8/src/objects/js-function-inl.h:252
| #6  v8::internal::JSFunction::shared (this=<optimized out>, cage_base=...) at ../deps/v8/src/objects/js-function-inl.h:247
| #7  v8::internal::JSFunction::shared (this=<optimized out>) at ../deps/v8/src/objects/js-function-inl.h:246
| #8  v8::internal::__RT_impl_Runtime_InstallBaselineCode (args=..., isolate=0x2aaab82000) at ../deps/v8/src/runtime/runtime-compiler.cc:91
| #9  v8::internal::Runtime_InstallBaselineCode (args_length=1, args_object=0x3fffffe398, isolate=0x2aaab82000) at ../deps/v8/src/runtime/runtime-compiler.cc:87
| #10 0x0000003ff4b12364 in Builtins_CEntry_Return1_ArgvOnStack_NoBuiltinExit () from /home/aurel32/nodejs/nodejs-24.22.0+dfsg+~cs24.19.2/out/Release/libnode.so.137
| Backtrace stopped: frame did not save the PC
| (gdb)

I have rebuilt version 24.21.0+dfsg+~cs24.13.4-1 in the same
environment, and it works fine, so the issue is not due to a dependency.

I have also been able to reproduce the issue with upstream tag v24.22.0
as well as v24.22.1. On the other hand upstream tag v24.21.0 works fine,
so the issue is not due to a debian change.

I have started bisecting, but it will take some time.

Regards
Aurelien

#1151837#10
Date:
2026-10-24 09:24:38 UTC
From:
To:
...

Here is the result:

| fb0d0ca28993802d67360edc84d467fe3ccdc20b is the first 'bad' commit
| commit fb0d0ca28993802d67360edc84d467fe3ccdc20b (HEAD)
| Author: Ruan Gustavo <dev.ruangustavo@gmail.com>
| Date:   Wed Sep 2 22:00:20 2026 -0300
| 
|     deps: V8: backport 0b94a9fd23ba
| 
|     Original commit message:
| 
|         [leaptiering] Fix BaselineOutOfLinePrologue builtin
| 
|         ... which tried to preserve kJavaScriptCallDispatchHandleRegister even
|         on configurations where it's not used which resulted in a random value
|         on the stack discoverable by GC.
|         This issue triggered only on non-sandbox configuration with enabled
|         leaptiering.
| 
|         Drive-by: fix MacroAssembler::GenerateTailCallToReturnedCode() on riscv
|         port which wasn't preserving dispatch handle as all the other ports do.
| 
|         Bug: 42204201
|         Fixed: 413769394
| 
|         Change-Id: If146b0b7a6cf972ed5a881142f40980774f19cba
|         Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6587010
|         Commit-Queue: Igor Sheludko <ishell@chromium.org>
|         Reviewed-by: Olivier Flückiger <olivf@chromium.org>
|         Cr-Commit-Position: refs/heads/main@{#100512}
| 
|     Node.js 24 builds V8 with leaptiering enabled and the sandbox disabled,
|     so V8_JS_LINKAGE_INCLUDES_DISPATCH_HANDLE is not defined and the JS
|     calling convention does not carry the dispatch handle register (x4 on
|     arm64). BaselineOutOfLinePrologue and GenerateTailCallToReturnedCode
|     still pushed that register as a tagged slot of an INTERNAL frame, so
|     whatever value the caller left there is dereferenced by
|     ClearStaleLeftTrimmedPointerVisitor during mark-compact root scanning
|     and crashes the process with SIGSEGV (seen as jest workers dying).
| 
|     Refs: https://github.com/v8/v8/commit/0b94a9fd23ba5f59b3f675fb04d60a9b0102e27d
|     Fixes: https://github.com/nodejs/node/issues/62393
|     PR-URL: https://github.com/nodejs/node/pull/65753
|     Reviewed-By: Richard Lau <richard.lau@ibm.com>
| 
|  common.gypi                                            |  2 +-
|  deps/v8/src/builtins/arm64/builtins-arm64.cc           |  3 ++-
|  deps/v8/src/builtins/loong64/builtins-loong64.cc       |  5 +++--
|  deps/v8/src/builtins/mips64/builtins-mips64.cc         |  5 +++--
|  deps/v8/src/builtins/riscv/builtins-riscv.cc           |  7 +++++--
|  deps/v8/src/builtins/x64/builtins-x64.cc               |  5 +++--
|  deps/v8/src/codegen/arm64/macro-assembler-arm64.cc     | 11 ++++++-----
|  deps/v8/src/codegen/loong64/macro-assembler-loong64.cc |  5 +++--
|  deps/v8/src/codegen/mips64/macro-assembler-mips64.cc   |  5 +++--
|  deps/v8/src/codegen/riscv/macro-assembler-riscv.cc     | 18 +++++++++++++++---
|  deps/v8/src/codegen/x64/macro-assembler-x64.cc         |  5 +++--
|  11 files changed, 47 insertions(+), 24 deletions(-)

I have tested that reverting that commit on upstream v24.22.1 or on the
Debian package fix the issue. I still need to understand what is broken,
any help is welcome.

Regards
Aurelien

#1151837#15
Date:
2026-10-26 22:47:07 UTC
From:
To:
Hi,
https://chromium.googlesource.com/v8/v8.git/+/ec2f506f97dfbb5fa19e4fe9103965a3c94690af

Backporting it to the embedded v8 copy fixes the issue.

Regards
Aurelien