-
Notifications
You must be signed in to change notification settings - Fork 36.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add patch to make codesign_allocate compatible with Apple's #20644
Conversation
6e9f0fa
to
e4eb1ac
Compare
e4eb1ac
to
a4118c6
Compare
Tried this with a self signed certificate. Apparently my gitian is doing something incorrectly. Running the apply locally works as expected and the correct binary is produced. |
Tested ACK a4118c6 - removed the osx cache, built commit a4118c6 for osx in gitian (dependency where built, patch was applied), signed on my signing mac (detach-sig-create), ran gitian osx signer with the produces signature and the a4118c6 build (detach-sig-apply), signature then was successful verified on my Mac (codesign -v /Volumes/Bitcoin-Core/Bitcoin-Qt.app) |
While this patch looks simple, it feels like black magic (at least without the PR description), so I currently prefer #20638. Also given this is patching |
Concept ACK a4118c6 |
Updated PR description. @fanquake It's easy to trace which functions in cctools call get_segalign_from_flag (the only function that accesses the modified field): it's |
Github-Pull: bitcoin#20644 Rebased-From: a4118c6
…ith Apple's a4118c6 Add patch to make codesign_allocate compatible with Apple's (Pieter Wuille) Pull request description: This is an alternative to bitcoin#20638. The problem is that Apple's codesign(_allocate) apparently rounds the "vmsize" attribute on the __LINKEDIT section to a multiple of 0x2000 on x86_64 rather than 0x1000 (as their published source code does). This divergence means that the binary signed by codesign is slightly different from the one recreated by our reattach-sig-to-gitian-output process, and the signature being invalid. This fixes it by patching our codesign_allocate source code to also use 0x2000. In tests, this appears to result in matching binaries. ACKs for top commit: jonasschnelli: Tested ACK a4118c6 - removed the osx cache, built commit a4118c6 for osx in gitian (dependency where built, patch was applied), signed on my signing mac (detach-sig-create), ran gitian osx signer with the produces signature and the a4118c6 build (detach-sig-apply), signature then was successful verified on my Mac (codesign -v /Volumes/Bitcoin-Core/Bitcoin-Qt.app) MarcoFalke: Concept ACK a4118c6 Tree-SHA512: 07b8cdf8216249ddfe4bd38b39f2b48b2e190d4002b84d8981e62197bbbc9f25ac5c137bcc32057b23fbf38cbb2889ef95101ce008edfbf608cd170b88b3acbc
Being backported to 0.21 in #20669. |
Github-Pull: bitcoin#20644 Rebased-From: a4118c6
Github-Pull: bitcoin#20644 Rebased-From: a4118c6
Github-Pull: bitcoin#20644 Rebased-From: a4118c6 Co-authored-by: Pieter Wuille <pieter@wuille.net>
Github-Pull: bitcoin#20644 Rebased-From: a4118c6 Co-authored-by: Pieter Wuille <pieter@wuille.net>
Github-Pull: bitcoin#20644 Rebased-From: a4118c6
Github-Pull: bitcoin#20644 Rebased-From: a4118c6 Co-authored-by: Pieter Wuille <pieter@wuille.net>
Github-Pull: bitcoin#20644 Rebased-From: a4118c6 Co-authored-by: Pieter Wuille <pieter@wuille.net>
…atible with Apple's" a0eb4c5 Revert "Add patch to make codesign_allocate compatible with Apple's" (Pieter Wuille) Pull request description: This reverts bitcoin#20644. It appears that Apple has recently changed their `codesign_allocate` tool back to using 4k alignment on x86_64, at least in some cases, so this patch isn't causing our cctools-based version to be exactly compatible. Furthermore, if codesigning were to change to use https://github.com/achow101/signapple instead, there is no need anymore to try to mimick Apple. ACKs for top commit: laanwj: ACK a0eb4c5 MarcoFalke: checked-clean-revert ACK a0eb4c5 jonasschnelli: ACK a0eb4c5 Tree-SHA512: 529719a76811006122406689233d1e80995107fe1ac1fc862a4ac53ca21685748ed76cac7ca648dd70f0ea43dd8dcf2e29d559beeab10e1d30dc5542ac95fd97
…atible with Apple's" a0eb4c5 Revert "Add patch to make codesign_allocate compatible with Apple's" (Pieter Wuille) Pull request description: This reverts bitcoin#20644. It appears that Apple has recently changed their `codesign_allocate` tool back to using 4k alignment on x86_64, at least in some cases, so this patch isn't causing our cctools-based version to be exactly compatible. Furthermore, if codesigning were to change to use https://github.com/achow101/signapple instead, there is no need anymore to try to mimick Apple. ACKs for top commit: laanwj: ACK a0eb4c5 MarcoFalke: checked-clean-revert ACK a0eb4c5 jonasschnelli: ACK a0eb4c5 Tree-SHA512: 529719a76811006122406689233d1e80995107fe1ac1fc862a4ac53ca21685748ed76cac7ca648dd70f0ea43dd8dcf2e29d559beeab10e1d30dc5542ac95fd97
This is an alternative to #20638.
The problem is that Apple's codesign(_allocate) apparently rounds the "vmsize" attribute on the __LINKEDIT section to a multiple of 0x2000 on x86_64 rather than 0x1000 (as their published source code does). This divergence means that the binary signed by codesign is slightly different from the one recreated by our reattach-sig-to-gitian-output process, and the signature being invalid.
This fixes it by patching our codesign_allocate source code to also use 0x2000. In tests, this appears to result in matching binaries.