Skip to content

[Serialization] Harden the compiler tag check on swiftmodules #58880

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

Merged
merged 1 commit into from
May 13, 2022

Conversation

xymus
Copy link
Contributor

@xymus xymus commented May 12, 2022

When two different serialization formats share a version number but are different enough, it can defeat the check to restrict loading swiftmodules built by the same compiler. Add a backup check in case the REVISION block is not seen to detect such issues. This applies to swiftmodules only and not to swiftdoc or sourceinfo files.

rdar://93188070

When two different serialization formats share a version number but are
different enough, it can defeat the check to restrict loading
swiftmodules built by the same compiler. Add a backup check in case the
REVISION block is unseen, for swiftmodules only not swiftdoc or
sourceinfo.

rdar://93188070
@xymus xymus requested a review from bnbarham May 12, 2022 20:21
@xymus
Copy link
Contributor Author

xymus commented May 12, 2022

@swift-ci Please smoke test

if (requiresRevisionMatch &&
!revisionSeen &&
result.status == Status::Valid)
result.status = Status::RevisionIncompatible;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should it just be Status::Malformed in that case? Ie. the same as the missing version case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It could be, but I like having a different code for it. I would expect to see Malformed if the header is missing/truncated, while RevisionIncompatible remains a case where the format is mostly fine but it was definitively written by a different compiler.

@xymus xymus merged commit 78f937f into swiftlang:main May 13, 2022
@xymus xymus deleted the harden-swiftmodule-per-tag-check branch May 13, 2022 20:40
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.

2 participants