From e293359b922457499663dd8350d511d3cca6ac37 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 30 Sep 2020 16:40:48 +0200 Subject: [PATCH] unix: use correct cmsg alignment for netbsd/arm64 netbsd/arm64 requires 128-bit alignment for cmsgs. Change-Id: I49d7a4dc223f15322c795569292b24200cedd389 Reviewed-on: https://go-review.googlesource.com/c/sys/+/258457 Trust: Tobias Klauser Trust: Benny Siegert Run-TryBot: Tobias Klauser TryBot-Result: Go Bot Reviewed-by: Benny Siegert --- unix/sockcmsg_unix_other.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/unix/sockcmsg_unix_other.go b/unix/sockcmsg_unix_other.go index abdedcf1..57a0021d 100644 --- a/unix/sockcmsg_unix_other.go +++ b/unix/sockcmsg_unix_other.go @@ -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)