]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: use correct cmsg alignment for netbsd/arm64
authorTobias Klauser <tklauser@distanz.ch>
Thu, 1 Oct 2020 08:25:20 +0000 (10:25 +0200)
committerTobias Klauser <tobias.klauser@gmail.com>
Thu, 1 Oct 2020 13:23:43 +0000 (13:23 +0000)
netbsd/arm64 requires 128-bit alignment for cmsgs.

Re-submit of CL 258437 which was dropped due to #41718.

Change-Id: I898043d79f513bebe1a5eb931e7ebd8e291a5aec
Reviewed-on: https://go-review.googlesource.com/c/go/+/258677
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
src/syscall/sockcmsg_unix_other.go

index 3aaf7c3616c6331aa936b155754f41447c8360d0..40f03142a6391a95e92478c4a78d1e132cab3ac8 100644 (file)
@@ -32,6 +32,10 @@ func cmsgAlignOf(salen int) int {
                if runtime.GOARCH == "arm" {
                        salign = 8
                }
+               // NetBSD aarch64 requires 128-bit alignment.
+               if runtime.GOOS == "netbsd" && runtime.GOARCH == "arm64" {
+                       salign = 16
+               }
        }
 
        return (salen + salign - 1) & ^(salign - 1)