Skip to content
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

.NET 8 Runtime Bad Signature / Certificate for MacOS arm64 #100413

Closed
nagilson opened this issue Mar 28, 2024 · 13 comments
Closed

.NET 8 Runtime Bad Signature / Certificate for MacOS arm64 #100413

nagilson opened this issue Mar 28, 2024 · 13 comments

Comments

@nagilson
Copy link
Member

nagilson commented Mar 28, 2024

Over on the DevKit side, we have a number of users on MacOS reporting this error:
microsoft/vscode-dotnettools#1002

This appears to be an issue with the runtime signatures for the local .zip runtimes shipped out and installed via the install scripts. Surprisingly, it is not just a problem with the 8.0.1 arm64 runtime but also the 8.0.3 arm64 runtime, at minimum. I imagine the same can be said for the 8.0.2 one as users would have temporarily been relieved of this issue via an automatic update.

.NET server STDERR: Failed to load /opt/homebrew/Cellar/dotnet/8.0.1/libexec/host/fxr/8.0.1/libhostfxr.dylib, error: dlopen(/opt/homebrew/Cellar/dotnet/8.0.1/libexec/host/fxr/8.0.1/libhostfxr.dylib, 0x0001): tried: '/opt/homebrew/Cellar/dotnet/8.0.1/libexec/host/fxr/8.0.1/libhostfxr.dylib' (code signature in <D9F7F506-1864-386E-9591-E9805FDE7F6C> '/opt/homebrew/Cellar/dotnet/8.0.1/libexec/host/fxr/8.0.1/libhostfxr.dylib' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/dotnet/8.0.1/libexec/host/fxr/8.0.1/libhostfxr.dylib' (no such file), '/opt/homebrew/Cellar/dotnet/8.0.1/libexec/host/fxr/8.0.1/libhostfxr.dylib' (code signature in <D9F7F506-1864-386E-9591-E9805FDE7F6C> '/opt/homebrew/Cellar/dotnet/8.0.1/libexec/host/fxr/8.0.1/libhostfxr.dylib' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs)

cc @jeffschwMSFT

Copy link
Contributor

Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov
See info in area-owners.md if you want to be subscribed.

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Mar 28, 2024
@nagilson nagilson changed the title .NET 8 Runtime Bad Signature / Certificate for MacOS .NET 8 Runtime Bad Signature / Certificate for MacOS arm64 Mar 28, 2024
@jeffschwMSFT
Copy link
Member

jeffschwMSFT commented Mar 28, 2024

@mmitche / @agocke thoughts on who is the best to look at a potential signing issue on .NET Core native component (on macOS)?

@agocke
Copy link
Member

agocke commented Mar 28, 2024

@joeloff

@agocke
Copy link
Member

agocke commented Mar 28, 2024

local .zip runtimes shipped out and installed via the install scripts.

FYI, that error is from someone installing via homebrew, not directly via the install scripts. So there may be some homebrew stuff going on in between

@nagilson
Copy link
Member Author

nagilson commented Mar 28, 2024

One install is via homebrew (8 0 1), the other (8 0 3) is via the install script. Presumably they hit the error on both given their messages, but they never actually 100% confirmed that.

@vcsjones
Copy link
Member

I can hit this installing nightlies, too, since those are not signed.

@joeloff
Copy link
Member

joeloff commented Mar 28, 2024

Runtime either signs during the build, like in 7+ or post build during staging. If signatures are missing or incorrect then it's likely an infra issue, or someone didn't add a file to a list to be signed. Either way, I'd start with engineering. We're supposed to be validating the signatures.

Has anyone diff'd the file in the tar.gz and .pkg to see if it's the same file?

@nagilson
Copy link
Member Author

nagilson commented Apr 1, 2024

@agocke, @joeloff is responsible for a lot of SDK and workload signatures but we dont know much about the runtime signing and validation process. Do you know who would manage the infra @joeloff suggested above so they can take a look?

@agocke
Copy link
Member

agocke commented Apr 3, 2024

I just downloaded the 8.0.3 tar.gz and the files all seem to pass the signing scan with correct signatures.

@vcsjones
Copy link
Member

vcsjones commented Apr 3, 2024

The binaries from Homebrew are ad-hoc signed, not signed by Microsoft. You can reproduce this issue by

  1. Completely uninstall all of .NET.
  2. Install .NET with Homebrew on Apple Silicon (brew install dotnet)
  3. Start VS Code and activate DevKit
codesign -dv /opt/homebrew/Cellar/dotnet/8.0.3/libexec/host/fxr/8.0.3/libhostfxr.dylib
Executable=/opt/homebrew/Cellar/dotnet/8.0.3/libexec/host/fxr/8.0.3/libhostfxr.dylib
Identifier=libhostfxr-55554944e079e2218f4232fcbc25de741b71ed09
Format=Mach-O thin (arm64)
CodeDirectory v=20400 size=3020 flags=0x2(adhoc) hashes=88+2 location=embedded
Signature=adhoc
Info.plist=not bound
TeamIdentifier=not set
Sealed Resources=none
Internal requirements count=0 size=12

The DevKit process is signed with Team ID: UBF8T346G9

Library Validation failed: Rejecting '/opt/homebrew/Cellar/dotnet/8.0.3/libexec/host/fxr/8.0.3/libhostfxr.dylib' (Team ID: none, platform: no) for process 'Microsoft.Visual(59918)' (Team ID: UBF8T346G9, platform: no), reason: mapping process and mapped file (non-platform) have different Team IDs

A process that is signed with one Apple Code Signing Identity cannot load libraries that are signed by a different team, or in this case, no team (ad-hoc).

@vcsjones
Copy link
Member

vcsjones commented Apr 3, 2024

Note that nightlies from dotnet/installer are also not signed, which is why I have this problem with nightly builds.

@vcsjones
Copy link
Member

vcsjones commented Apr 3, 2024

I think the only solution here would be for Dev Kit to not consider installations of the Framework / Runtime / SDK that are unsigned.

@agocke
Copy link
Member

agocke commented Apr 4, 2024

Closing as a dev kit issue

@agocke agocke closed this as completed Apr 4, 2024
@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label Apr 4, 2024
@github-actions github-actions bot locked and limited conversation to collaborators May 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

No branches or pull requests

5 participants