Skip to content

Commit 1a53732

Browse files
committed
arm64 runtime.badsignal2, set r3 to defined value
We ran into an issue on the hololens which is an arm64 windows platform. We noticed that in runtime.badsignal2 it would call WriteFile, but then we would get an Access Violation inside it when it attempted to derefence the lpNumberOfBytesWritten variable. It appears that runtime.badsignal2 is assigning this variable, which is a point, to whatever is in r13 (note this is assembly), but I don't see where r13 is initialized and in our case it was set to 1, so WriteFile ended up dereferencing the value 1 causing the Access Violation. This change modifies the assembly to set r3 to 0 which tells WriteFile not to dereference lpNumberOBytesWritten.
1 parent 6eb58cd commit 1a53732

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/runtime/sys_windows_arm64.s

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ TEXT runtime·badsignal2(SB),NOSPLIT,$16-0
112112
MOVD $runtime·badsignalmsg(SB), R1 // lpBuffer
113113
MOVD $runtime·badsignallen(SB), R2 // lpNumberOfBytesToWrite
114114
MOVD (R2), R2
115-
MOVD R13, R3 // lpNumberOfBytesWritten
115+
MOVD $0, R3 // lpNumberOfBytesWritten
116116
MOVD $0, R4 // lpOverlapped
117117
MOVD runtime·_WriteFile(SB), R12
118118
SUB $16, RSP // skip over saved frame pointer below RSP

0 commit comments

Comments
 (0)