Skip to content

Conversation

@mmitche
Copy link
Member

@mmitche mmitche commented Jul 26, 2022

When attempting to re-enable in-build signing, runtime was throwing out an error that Microsoft.NETCore.App.Composite.r2r.dll had an empty copyright (interpreted as non-MSFT) but was being signed with a Microsoft cert. What was happening was that this r2r binary, because of the way it's created, doesn't have the assembly attributes with copyright info that would normally be present.

In this case, as well as native binaries, we should be using the file version info present in native resources to find the copyright info. This is used as a fallback for managed binaries, and always in the case of native (which didn't have copyright info before).

To double check:

When attempting to re-enable in-build signing, runtime was throwing out an error that Microsoft.NETCore.App.Composite.r2r.dll had an empty copyright (interpreted as non-MSFT) but was being signed with a Microsoft cert. What was happening was that this r2r binary, because of the way it's created, doesn't have the assembly attributes with copyright info that would normally be present.

In this case, as well as native binaries, we should be using the file version info present in native resources to find the copyright info. This is used as a fallback for managed binaries, and always in the case of native (which didn't have copyright info before).
@mmitche
Copy link
Member Author

mmitche commented Jul 26, 2022

https://dev.azure.com/dnceng/internal/_build/results?buildId=1905066&view=results for official build, then will test in key repos that build native code/these r2r binaries

hoyosjs
hoyosjs previously approved these changes Jul 27, 2022
Copy link
Member

@hoyosjs hoyosjs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic seems solid - the test just needs adjustment as the empty copyright is really a space in the native resource.

@mmitche
Copy link
Member Author

mmitche commented Jul 27, 2022

Logic seems solid - the test just needs adjustment as the empty copyright is really a space in the native resource.

Yep, found that one out. Also fixed possible null-deref.

In my test build with runtime (which crashed due to a bug), it was already throwing out some errors due to copyright in native binaries. So there may be some cleanup to do there.

hoyosjs
hoyosjs previously approved these changes Jul 27, 2022
@mmitche mmitche mentioned this pull request Nov 3, 2025
2 tasks
@mmitche
Copy link
Member Author

mmitche commented Aug 4, 2022

Turned this into a message for now. Will need some tweaks to the tests.

@mmitche
Copy link
Member Author

mmitche commented Aug 4, 2022

Updated, PTAL

hoyosjs
hoyosjs previously approved these changes Aug 4, 2022
// Turn the else into a warning (and hoist into the if above) after issue is complete.
if (peInfo.IsManaged)
{
LogWarning(SigningToolErrorCode.SIGN001, warning);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be use the same warn code here? Wont it be confusing in case someone disables the warn?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They were all used SIGN001 before, but it makes sense to split them. I'm changed it to SIGN001 and a new one SIGN004.

}
}

// If there is no copyright available, it's possible this was a r2r binary. Get the native info instead.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// If there is no copyright available, it's possible this was a r2r binary. Get the native info instead.
// If there is no copyright available as metadata, it's possible it has an RT_VERSION Windows resource instead.

@mmitche mmitche merged commit f08ccdc into dotnet:main Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants