[arm64] Fix frame size to account for q registers

In https://crrev.com/c/2645694 we push the full q registers before lazy
compile, but we did not change the fixed frame size to account for the
wider registers being pushed.

This manifested in the frame having data like:

(gdb) x/10xg start.ptr_
0x7f5576ff3eb0: 0x0000000000000000      0x0000336b08202759
0x7f5576ff3ec0: 0x7ff000007f801000      0x0000000000000000
0x7f5576ff3ed0: 0x7ff000007f801001      0x0000000000000000
0x7f5576ff3ee0: 0x7ff000007f801002      0x0000000000000000
0x7f5576ff3ef0: 0x7ff000007f801003      0x0000000000000000

The GC then walks part of this frame, thinking that 0x7ff000007f801003
is a heap object, and then crashes.

Add some static_asserts (similar to builtins-x64) to remind ourselves
that the pushed registers have to match the size in frame constants.

Bug: chromium:1161555,v8:11358
Change-Id: Ic5138cc17ad44ccab9121ca226f9f812afef72c7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2656857
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72439}
This commit is contained in:
Ng Zhi An 2021-01-28 11:04:01 -08:00 committed by Commit Bot
parent 5a4394ac9d
commit 45b99aaa58
2 changed files with 7 additions and 1 deletions

View File

@ -2696,6 +2696,12 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
Register::ListOf(x0, x1, x2, x3, x4, x5, x6, x7);
constexpr RegList fp_regs =
Register::ListOf(d0, d1, d2, d3, d4, d5, d6, d7);
static_assert(WasmCompileLazyFrameConstants::kNumberOfSavedGpParamRegs ==
NumRegs(gp_regs),
"frame size mismatch");
static_assert(WasmCompileLazyFrameConstants::kNumberOfSavedFpParamRegs ==
NumRegs(fp_regs),
"frame size mismatch");
__ PushXRegList(gp_regs);
__ PushQRegList(fp_regs);

View File

@ -81,7 +81,7 @@ class WasmCompileLazyFrameConstants : public TypedFrameConstants {
// Header is padded to 16 byte (see {MacroAssembler::EnterFrame}).
RoundUp<16>(TypedFrameConstants::kFixedFrameSizeFromFp) +
kNumberOfSavedGpParamRegs * kSystemPointerSize +
kNumberOfSavedFpParamRegs * kDoubleSize;
kNumberOfSavedFpParamRegs * kSimd128Size;
};
// Frame constructed by the {WasmDebugBreak} builtin.