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

Temporarily support missing raw cmd line in the evidence #4958

Merged
merged 3 commits into from
Mar 25, 2024

Conversation

k-naliuka
Copy link
Contributor

Verification only succeeds if the corresponding value is set to skip

…n only succeeds if the corresponding value is set to skip
@k-naliuka k-naliuka requested review from tiziano88 and timonvo March 25, 2024 19:57
@k-naliuka k-naliuka enabled auto-merge (squash) March 25, 2024 19:57
@k-naliuka k-naliuka disabled auto-merge March 25, 2024 20:17
@@ -146,7 +146,7 @@ message KernelLayerData {
RawDigest kernel_cmd_line = 2 [deprecated = true];

// Command-line that was passed to the kernel during startup.
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding a comment here stating what the significance is between an absent field and a present-but-empty field.

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1 in fact I'm not sure I am reading the logic correctly, could you clarify the intention?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a comment, more context for this change in b/325979696

Copy link
Contributor

Choose a reason for hiding this comment

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

It may make sense to establish a new pattern, where instead of having a single 'obsolete' evidence copy and a single 'current' evidence copy you accumulate more and more evidence protos over time and simply name them by date (e.g. 'rk_evidence_20240312' etc.) and then always add more tests to verifier_tests.rs as new fields are added or old ones are deprecated, always keeping old tests with old Evidence and old ReferenceValues around to ensure that they continue to pass. That probably would ensure we have a better chance of catching backward-incompatible changes using this unit test.

Not necessarily something you need to address in this CL, but you could consider naming this as 'rk_evidence_20240312' or something similar already.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, done. Though I hope that with existing users migrated and our patterns becoming more stable we'll end up with just one version here again :)

)
.context("kernel command line failed verification")?;
} else {
// Support missing kernel_cmd_line_regex but only if the corresponding reference
Copy link
Collaborator

Choose a reason for hiding this comment

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

FWIW this still feels backwards to me (i.e. we should start from the expected reference value). I know we agreed to clean it up later on anyway :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack :)

@@ -146,7 +146,7 @@ message KernelLayerData {
RawDigest kernel_cmd_line = 2 [deprecated = true];

// Command-line that was passed to the kernel during startup.
Copy link
Collaborator

Choose a reason for hiding this comment

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

+1 in fact I'm not sure I am reading the logic correctly, could you clarify the intention?

Copy link
Contributor Author

@k-naliuka k-naliuka left a comment

Choose a reason for hiding this comment

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

Thanks for the review!

)
.context("kernel command line failed verification")?;
} else {
// Support missing kernel_cmd_line_regex but only if the corresponding reference
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, done. Though I hope that with existing users migrated and our patterns becoming more stable we'll end up with just one version here again :)

@@ -146,7 +146,7 @@ message KernelLayerData {
RawDigest kernel_cmd_line = 2 [deprecated = true];

// Command-line that was passed to the kernel during startup.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a comment, more context for this change in b/325979696

@k-naliuka k-naliuka enabled auto-merge (squash) March 25, 2024 20:47
// migrated.
anyhow::ensure!(
matches!(
reference_values.kernel_cmd_line_regex.as_ref().unwrap().r#type.as_ref(),
Copy link
Contributor

Choose a reason for hiding this comment

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

I also just noticed that this unwrap() call will crash/panic if no kernel_cmd_line_regex field is specified in the ReferenceValues, as opposed to generating a (recoverable) error., which seems undesirable given that that field is now optional.

@k-naliuka k-naliuka merged commit 906a687 into project-oak:main Mar 25, 2024
24 checks passed
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.

3 participants