]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: correct setNonblock on linux/arm64
authorJoel Sing <joel@sing.id.au>
Mon, 6 Jan 2020 17:31:23 +0000 (04:31 +1100)
committerJoel Sing <joel@sing.id.au>
Tue, 7 Jan 2020 02:56:05 +0000 (02:56 +0000)
The current code uses EOR (exclusive OR), which will result in the O_NONBLOCK
flag being toggled rather than being set. Other implementations use OR, hence
this is likely a bug.

Change-Id: I5dafa9c572452070bd37789c8a731ad6d04a86cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/212766
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/runtime/sys_linux_arm64.s

index 8a0f06f206b5a5a18e4bdd060d491642b63003a7..8c2a249c9fed2c52350d2032cb6657037cb25dc4 100644 (file)
@@ -688,7 +688,7 @@ TEXT runtimeĀ·setNonblock(SB),NOSPLIT|NOFRAME,$0-4
        MOVD    $SYS_fcntl, R8
        SVC
        MOVD    $0x800, R2 // O_NONBLOCK
-       EOR     R0, R2
+       ORR     R0, R2
        MOVW    fd+0(FP), R0 // fd
        MOVD    $4, R1  // F_SETFL
        MOVD    $SYS_fcntl, R8