Skip to content

Commit

Permalink
syscall: use correct cmsg alignment for netbsd/arm64
Browse files Browse the repository at this point in the history
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 <[email protected]>
Trust: Benny Siegert <[email protected]>
Run-TryBot: Tobias Klauser <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Reviewed-by: Benny Siegert <[email protected]>
  • Loading branch information
tklauser committed Oct 1, 2020
1 parent 9b1518a commit 069aef4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/syscall/sockcmsg_unix_other.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 069aef4

Please sign in to comment.