riscv64: every script segfaults in Runtime_InstallBaselineCode since v24.22.0 (backport of V8 0b94a9fd23ba dropped the runtime argument)
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 72/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- c, cpp, javascript
研究方向
從 #65753 中的 V8 回移植開始,檢查 deps/v8/src/codegen/riscv/macro-assembler-riscv.cc,尤其是 MacroAssembler::GenerateTailCallToReturnedCode。將它的暫存器推入堆疊操作與 v24.21.0 和 main 進行比較,然後在 riscv64 上建置並執行 out/Release/node -p 1+1。如果命令未發生分段錯誤並印出 2,就算完成。
由索引模型根據 Issue 內容生成。
描述
Version
v24.22.1, built from source. v24.22.3 and the head of v24.x carry the same line. v24.21.0 and main are not affected.
Platform
Linux 6.18 riscv64 (SpacemiT K3), Ubuntu 26.04, gcc 15.2, `./configure --openssl-no-asm`
Subsystem
deps (V8, riscv64 port)
What steps will reproduce the bug?
Build v24.22.1 natively on riscv64 and run any script:
$ out/Release/node --version
v24.22.1
$ out/Release/node -p 1+1
Segmentation fault (core dumped)
--no-sparkplug and --jitless both avoid it.
How often does it reproduce? Is there a required condition?
Always, on the first function that takes the baseline path.
What is the expected behavior? Why is that the expected behavior?
2
What do you see instead?
Thread 1 "MainThread" received signal SIGSEGV, Segmentation fault.
#0 v8::internal::Runtime_InstallBaselineCode(int, unsigned long*, v8::internal::Isolate*) ()
#1 Builtins_CEntry_Return1_ArgvOnStack_NoBuiltinExit ()
Additional information
#65753 (backport of V8 0b94a9fd23ba, in v24.22.0) rewrote MacroAssembler::GenerateTailCallToReturnedCode in deps/v8/src/codegen/riscv/macro-assembler-riscv.cc. The Push went from four registers to three and lost the second kJavaScriptCallTargetRegister, which is the one argument of the CallRuntime(function_id, 1) that follows. The runtime function then reads the slot below as its argument: in the crash args[0] is 0x100000000, the Smi-tagged argument count, not a JSFunction. The disassembly of Builtins_InterpreterEntryTrampoline shows three stores before the call; the v24.21.0 source pushes four.
main pushes the function separately before the call, so only the backport is affected. Restoring the register fixes it:
--- a/deps/v8/src/codegen/riscv/macro-assembler-riscv.cc
+++ b/deps/v8/src/codegen/riscv/macro-assembler-riscv.cc
@@ -202,7 +202,7 @@
Push(kJavaScriptCallDispatchHandleRegister);
#endif
Push(kJavaScriptCallTargetRegister, kJavaScriptCallNewTargetRegister,
- kJavaScriptCallArgCountRegister);
+ kJavaScriptCallArgCountRegister, kJavaScriptCallTargetRegister);
CallRuntime(function_id, 1);
// Use the return value before restoring a0
With that line a native build runs JavaScript, workers, child processes and npm. I have not checked whether the unofficial riscv64 binaries of 24.22.x show the same crash.
- 主要語言
- JavaScript
- 星號
- 124k
- 分支
- 38.1k
- 平均合併
- 4 天 21 小時
- 30 天內合併 PR
- 242
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
nodejs/node 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
util: parseArgs() treats a `-` inside a short option group as the `--` terminator可能已有人在做 @yohannesjoya 於 17 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 75/100
維護者通常 1 天內回覆
-
util.parseEnv and --env-file keep a leading UTF-8 BOM in the first key可能已有人在做 @helmipradita 於 21 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
node:internal/inspector/network_http: `TypeError: Missing dataLength` in event when response uses `setEncoding()`可能重新可做 關聯的 PR 已關閉且未合併。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
Stream.prototype.forEach will block in first promise in queue before read more chunk可能已有人在做 @mmustafasenoglu 於 56 天前認領。 未關閉doc
難度 2/5 1-3 小時 新手友好度 65/100
維護者通常 1 天內回覆
相似的 Issue
-
marketing
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
[bug]: Maximizing the Windows dashboard covers the taskbar可能已有人在做 @xiufengsun 今天認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 63/100
xiufengsun/TokenTracker#1152 · 1 則留言 ·
維護者通常 1 天內回覆
-
Bug Tests
難度 2/5 1-3 小時 新手友好度 78/100
JSPrismarine/JSPrismarine#3384 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 62/100
desec-io/desec-stack#1312 ·
維護者通常 14 天內回覆
-
難度 1/5 1-3 小時 新手友好度 72/100
w3c/csswg-drafts#14848 ·
維護者通常 1 天內回覆