-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
Description
We are trying to integrate V8 as an Arm64EC dynamic library into x64 Node.js. When running Node.js on a Windows on ARM PC, we encountered a crash. Through WinDbg analysis, we found that in v8_libbase.dll(ARM64EC build), there is a piece of assembly code that manipulates the x0 register before calling the function v8_libbase!v8::base::Vector::length. As a result, the length value obtained is not the valid value we expect, which lead s to the program crashing. The code snippet is as follows:
00007fff`4c78aa10 d10183ff sub sp,sp,#0x60
00007fff`4c78aa14 a9057bfd stp fp,lr,[sp,#0x50]
00007fff`4c78aa18 910143fd add fp,sp,#0x50
00007fff`4c78aa1c b0000228 adrp x8,v8_libbase!v8::base::g_abort_mode (00007fff`4c7cf000)
00007fff`4c78aa20 f9418108 ldr x8,[x8,#0x300]
00007fff`4c78aa24 f81f83a8 stur x8,[fp,#-8]
00007fff`4c78aa28 f81f03a1 stur x1,[fp,#-0x10]
00007fff`4c78aa2c f81e83a0 stur x0,[fp,#-0x18]
00007fff`4c78aa30 f81e03a3 stur x3,[fp,#-0x20]
00007fff`4c78aa34 f90017e2 str x2,[sp,#0x28]
00007fff`4c78aa38 f85e03a8 ldur x8,[fp,#-0x20]
00007fff`4c78aa3c f9000fe8 str x8,[sp,#0x18]
00007fff`4c78aa40 f94017e8 ldr x8,[sp,#0x28]
00007fff`4c78aa44 f9000be8 str x8,[sp,#0x10]
00007fff`4c78aa48 d10063a0 sub x0,fp,#0x18
00007fff`4c78aa4c f90003e0 str x0,[sp]
00007fff`4c78aa50 94000018 bl v8_libbase!v8::base::Vector<char>::length (00007fff`4c78aab0)
00007fff`4c78aa54 2a0003e1 mov w1,w0
00007fff`4c78aa58 f94003e0 ldr x0,[sp]
00007fff`4c78aa5c b9000fe1 str w1,[sp,#0xC]
00007fff`4c78aa60 94000049 bl v8_libbase!v8::base::Vector<char>::begin (00007fff`4c78ab84)
00007fff`4c78aa64 b9400fe1 ldr w1,[sp,#0xC]
00007fff`4c78aa68 f9400be2 ldr x2,[sp,#0x10]
00007fff`4c78aa6c f9400fe3 ldr x3,[sp,#0x18]
00007fff`4c78aa70 94003e88 bl v8_libbase!v8::base::OS::VSNPrintF (00007fff`4c79a490)
00007fff`4c78aa74 b90027e0 str w0,[sp,#0x24]
00007fff`4c78aa78 f85f83a9 ldur x9,[fp,#-8]
00007fff`4c78aa7c b0000228 adrp x8,v8_libbase!v8::base::g_abort_mode (00007fff`4c7cf000)
00007fff`4c78aa80 f9418108 ldr x8,[x8,#0x300]
00007fff`4c78aa84 eb090108 subs x8,x8,x9
00007fff`4c78aa88 54000041 bne v8_libbase!v8::base::VSNPrintF+0x80 (00007fff`4c78aa90)
00007fff`4c78aa8c 14000004 b v8_libbase!v8::base::VSNPrintF+0x8c (00007fff`4c78aa9c)
00007fff`4c78aa90 f85f83a0 ldur x0,[fp,#-8]
00007fff`4c78aa94 94005ba3 bl v8_libbase!#__security_check_cookie_arm64ec (00007fff`4c7a1920)
00007fff`4c78aa98 d4200020 brk #1
00007fff`4c78aa9c b94027e0 ldr w0,[sp,#0x24]
00007fff`4c78aaa0 a9457bfd ldp fp,lr,[sp,#0x50]
00007fff`4c78aaa4 910183ff add sp,sp,#0x60
00007fff`4c78aaa8 d65f03c0 ret
00007fff`4c78aaac 0001ece9 ???
The llvm/clang version we use is 21.1.3