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

Adding tests to snphostok #39

Merged
merged 2 commits into from
Feb 23, 2024
Merged

Conversation

arvindskumar99
Copy link
Contributor

@arvindskumar99 arvindskumar99 commented Feb 14, 2024

Added the following tests to snphostok

SME enabled | Checks that SMEE features are enabled on host | Checks MSR 0xC0010010 bit 23 for enablement

SEV INIT STATE | Checks to see if SEV is init | Checks SEV_PLATFORM_STATUS IOCTL

SEV-ES INIT STATE | Check to see if SEV-ES is init | Check SEV_PLATFORM_STATUS IOCTL

SNP enabled in MSR | Check to see if SNP is enabled | Check MSR 0xC0010010 bit 23

System SEV firmware version | Check for SEV FW version | Use SEV_PLATFORM_STATUS IOCTL

SNP INIT | Check if SNP is init | Check SNP_PLATFORM_STATUS IOCTL

RMP INIT | Check if RMP is init | Check SNP_PLATFORM STATUS IOCTL

RMP table addresses | Get the ranges for RMP TABLE ADDRESS | Check MSR 0xC0010132 - 0xC0010133

Compare TCB versions | Make sure current TCB and reported TCB match | Check SNP_PLATFORM_STATUS IOCTLS

Screenshot 2024-02-14 152654

Copy link
Contributor

@larrydewey larrydewey left a comment

Choose a reason for hiding this comment

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

Just one thought. I don't know that it is a stopper for me, but is worth the discussion.

src/ok.rs Outdated Show resolved Hide resolved
@larrydewey
Copy link
Contributor

Also, please make sure to rebase your branch :)

Copy link
Member

@DGonzalezVillal DGonzalezVillal left a comment

Choose a reason for hiding this comment

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

Great first PR!

I requested some changes regarding test readability and coding practices.

I also requested an enhancement on one of the tests that I forgot to mention earlier.

src/ok.rs Outdated Show resolved Hide resolved
src/ok.rs Outdated Show resolved Hide resolved
src/ok.rs Outdated Show resolved Hide resolved
src/ok.rs Outdated Show resolved Hide resolved
src/ok.rs Outdated Show resolved Hide resolved
src/ok.rs Outdated Show resolved Hide resolved
src/ok.rs Outdated Show resolved Hide resolved
src/ok.rs Outdated Show resolved Hide resolved
src/ok.rs Outdated Show resolved Hide resolved
src/ok.rs Outdated Show resolved Hide resolved
@tylerfanelli
Copy link
Member

tylerfanelli commented Feb 21, 2024

For something such as:

SME enabled: enabled

Are you referring to enabled in the kernel? The "parent" tests for CPU availability.

@arvindskumar99
Copy link
Contributor Author

For something such as:

SME enabled: enabled

Are you referring to enabled in the kernel? The "parent" tests for CPU availability.

The SME test is checking the MSR for cpu enablement. Do you want me to make that more clear in the result prompt?

@tylerfanelli
Copy link
Member

Just trying to understand the difference. So, although it can be supported on a certain CPU, it still must be enabled in the MSR (and all of this is completely separate from having kernel enablement of the same feature?)

Anyway, yes I think SME enabled by MSR would be a clearer message as to what this test does. Instead of printing enabled, you can just have the [ PASS ] show the enablement. Something like:

[ PASS ]   - Secure Memory Encryption (SME)
[ PASS ]       - SME enabled by MSR

src/ok.rs Outdated Show resolved Hide resolved
src/ok.rs Outdated Show resolved Hide resolved
src/ok.rs Outdated Show resolved Hide resolved
src/ok.rs Outdated Show resolved Hide resolved
src/ok.rs Outdated Show resolved Hide resolved
src/ok.rs Outdated Show resolved Hide resolved
src/ok.rs Outdated Show resolved Hide resolved
src/ok.rs Outdated Show resolved Hide resolved
src/ok.rs Outdated Show resolved Hide resolved
@larrydewey
Copy link
Contributor

@arvindskumar99 Looks like you still have some clippy and formatting issues. Please run:

cargo clippy -- -D clippy::all

and

cargo fmt

Signed-off-by: Arvind Kumar <[email protected]>
Copy link
Contributor

@larrydewey larrydewey left a comment

Choose a reason for hiding this comment

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

LGTM

@arvindskumar99
Copy link
Contributor Author

After changes

image

src/ok.rs Outdated Show resolved Hide resolved
Quick Patch

Signed-off-by: Larry Dewey <[email protected]>
@larrydewey larrydewey self-requested a review February 23, 2024 19:35
Copy link
Member

@DGonzalezVillal DGonzalezVillal left a comment

Choose a reason for hiding this comment

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

lgtm

@larrydewey larrydewey merged commit b8c3491 into virtee:main Feb 23, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants