Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(275)

Issue 141080043: code review 141080043: syscall: in linux/arm Syscall, zero R3, R4, R5 (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 8 months ago by rsc
Modified:
10 years, 8 months ago
Reviewers:
gobot, minux, dave, bradfitz
CC:
bradfitz, golang-codereviews
Visibility:
Public.

Description

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.

Patch Set 1 #

Patch Set 2 : diff -r 4f160f5ce72385bce1388054e440a4e7f4caa428 https://code.google.com/p/go/ #

Patch Set 3 : diff -r 1d866fb90d8402df9fb750aace5dc21c77a337e3 https://code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+3 lines, -0 lines) Patch
M src/pkg/syscall/asm_linux_arm.s View 1 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 6
rsc
Hello bradfitz (cc: golang-codereviews@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go/
10 years, 8 months ago (2014-09-05 03:12:08 UTC) #1
rsc
*** Submitted as https://code.google.com/p/go/source/detail?r=4fb2eea9ceb0 *** syscall: in linux/arm Syscall, zero R3, R4, R5 The general ...
10 years, 8 months ago (2014-09-05 03:12:15 UTC) #2
gobot
This CL appears to have broken the windows-386 builder. See http://build.golang.org/log/422b875114a0c33eac74796944721e61e24f5c63
10 years, 8 months ago (2014-09-05 03:15:00 UTC) #3
minux
LGTM.
10 years, 8 months ago (2014-09-05 03:31:49 UTC) #4
dave_cheney.net
LGTM. On 5 Sep 2014 13:12, <rsc@golang.org> wrote: > *** Submitted as > https://code.google.com/p/go/source/detail?r=4fb2eea9ceb0 *** ...
10 years, 8 months ago (2014-09-05 03:41:46 UTC) #5
bradfitz
10 years, 8 months ago (2014-09-05 04:23:50 UTC) #6
LGTM
 On Sep 4, 2014 8:12 PM, <rsc@golang.org> wrote:

> Reviewers: bradfitz,
>
> Message:
> Hello bradfitz (cc: golang-codereviews@googlegroups.com),
>
> I'd like you to review this change to
> https://code.google.com/p/go/
>
>
> Description:
> 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.
>
> Please review this at https://codereview.appspot.com/141080043/
>
> Affected files (+3, -0 lines):
>   M src/pkg/syscall/asm_linux_arm.s
>
>
> Index: src/pkg/syscall/asm_linux_arm.s
> ===================================================================
> --- a/src/pkg/syscall/asm_linux_arm.s
> +++ b/src/pkg/syscall/asm_linux_arm.s
> @@ -18,6 +18,9 @@
>         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
>
>
>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b