Skip to content

Commit 6a0a25a

Browse files
dramforeverV8 LUCI CQ
authored andcommitted
[riscv] Fix sp handling in MacroAssembler::LeaveFrame
Keep sp <= fp to ensure that data right above fp doesn't get clobbered by an inopportune signal and its handler. Such clobbering can happen in e.g. Node.js when JIT-compiled code is interrupted by a SIGCHLD handler. Bug: None Change-Id: Ief0836032ada7942e89f081f7605f61632c4d414 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7540554 Reviewed-by: Ji Qiu <[email protected]> Commit-Queue: Yahan Lu (LuYahan) <[email protected]> Reviewed-by: Rezvan Mahdavi Hezaveh <[email protected]> Cr-Commit-Position: refs/heads/main@{#105069}
1 parent 322f170 commit 6a0a25a

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ Vadim Gorbachev <[email protected]>
306306
Varun Varada <[email protected]>
307307
Victor Costan <[email protected]>
308308
Victor Polevoy <[email protected]>
309+
Vivian Wang <[email protected]>
309310
Vlad Burlik <[email protected]>
310311
Vladimir Kempik <[email protected]>
311312
Vladimir Krivosheev <[email protected]>

src/codegen/riscv/macro-assembler-riscv.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6782,9 +6782,10 @@ void MacroAssembler::EnterFrame(StackFrame::Type type, ShadowStackStatus ss) {
67826782

67836783
void MacroAssembler::LeaveFrame(StackFrame::Type type) {
67846784
ASM_CODE_COMMENT(this);
6785-
AddWord(sp, fp, 2 * kSystemPointerSize);
6785+
Move(sp, fp);
67866786
LoadWord(ra, MemOperand(fp, 1 * kSystemPointerSize));
67876787
LoadWord(fp, MemOperand(fp, 0 * kSystemPointerSize));
6788+
AddWord(sp, sp, 2 * kSystemPointerSize);
67886789
#ifdef V8_ENABLE_RISCV_SHADOW_STACK
67896790
sspopchk_ra();
67906791
#endif

0 commit comments

Comments
 (0)