summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-09-04 23:12:10 -0400
committerRuss Cox <rsc@golang.org>2014-09-04 23:12:10 -0400
commit566ae3b86ade8318c926b72d7c77bbbd975aa4bc (patch)
tree53d010a9e07e98fd899fd9ad105d544908e731b5
parentbec748f05a33fa6a2280b3b2c3e2a19d40763607 (diff)
downloadgo-566ae3b86ade8318c926b72d7c77bbbd975aa4bc.tar.gz
syscall: in linux/arm Syscall, zero R3, R4, R5
The general kernel system call interface takes 6 arguments: R0, R1, R2, R3, R4, R5. Syscall is for calls that only need 3. The amd64 and 386 versions zero the extra arg registers, but the arm version does not. func utimensat calls Syscall with 3 arguments. The kernel expects a 4th argument. That turns out to be whatever is in R3 at the time of the call. CL 137160043 changed various pieces of code and apparently changed the value left in R3 at the time of utimensat's Syscall. This causes the kernel to return EINVAL. Change linux/arm Syscall to zero R3, R4, R5, so that calls will behave deterministically, even if they pass too few arguments. Arguably, utimensat could be fixed too, but the predictable zeroing is certainly worth doing, and once done utimensat's use of Syscall is fine. Fixes arm build. TBR=bradfitz CC=golang-codereviews https://codereview.appspot.com/141080043
-rw-r--r--src/pkg/syscall/asm_linux_arm.s3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pkg/syscall/asm_linux_arm.s b/src/pkg/syscall/asm_linux_arm.s
index 014fa618f..3be0a13e1 100644
--- a/src/pkg/syscall/asm_linux_arm.s
+++ b/src/pkg/syscall/asm_linux_arm.s
@@ -18,6 +18,9 @@ TEXT ·Syscall(SB),NOSPLIT,$0-28
MOVW 8(SP), R0
MOVW 12(SP), R1
MOVW 16(SP), R2
+ MOVW $0, R3
+ MOVW $0, R4
+ MOVW $0, R5
SWI $0
MOVW $0xfffff001, R1
CMP R1, R0