]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/buildid: exclude Mach-O code signature in hash calculation
authorCherry Zhang <cherryyz@google.com>
Sat, 21 Nov 2020 22:43:16 +0000 (17:43 -0500)
committerCherry Zhang <cherryyz@google.com>
Tue, 1 Dec 2020 21:42:10 +0000 (21:42 +0000)
commit7fca39aa05ad3c60abac1ae51ae9847dfbe017d6
tree961ea71633e4768bd941a775b3ef78a2072b73db
parent7430266af4f951df3c113f2c817bc600650e2295
cmd/internal/buildid: exclude Mach-O code signature in hash calculation

The code signature contains hashes of the entire file (except the
signature itself), including the buildid. Therefore, the buildid
cannot depend on the signature. Otherwise updating buildid will
invalidate the signature, and vice versa. As we cannot change the
code-signing algorithm, we can only change buildid calculation.

This CL changes the buildid calculation to exclude the Mach-O
code signature. So updating code signature after stamping the
buildid will not invalidate the buildid.

Updates #38485, #42684.

Change-Id: I8a9e2e25ca9dc00d9556d13b81652f43bbf6a084
Reviewed-on: https://go-review.googlesource.com/c/go/+/272255
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/internal/buildid/buildid_test.go
src/cmd/internal/buildid/rewrite.go