Skip to content

Use SYSFS to read MSR_SEV_STATUS#88

Draft
joergroedel wants to merge 2 commits into
virtee:mainfrom
joergroedel:main
Draft

Use SYSFS to read MSR_SEV_STATUS#88
joergroedel wants to merge 2 commits into
virtee:mainfrom
joergroedel:main

Conversation

@joergroedel

Copy link
Copy Markdown

Avoid using the insecure MSR kernel module and use a file in SYSFS to read the SEV_STATUS MSR.

This is a draft PR as the SYSFS support patch is still under discussion here

The function is only ever used to read the SEV_STATUS MSR, so rename
it and hard-code the function parameters. This helps adding
alternative means to read SEV_STATUS.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
Since reading MSRs using the Linux MSR kernel module is generally
discouraged and disabled by default in many Linux distributions, add
another way of reading the SEV_STATUS value via SYSFS.

If that does not work the MSR module is still used as a fall-back.

Signed-off-by: Joerg Roedel <jroedel@suse.de>

@tylerfanelli tylerfanelli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, we'll wait for the changes to be upstream. Let us know when that's completed and we can merge this.

Just out of curiosity, why is the MSR module generally discouraged/disabled?

@joergroedel

Copy link
Copy Markdown
Author

Just out of curiosity, why is the MSR module generally discouraged/disabled?

The MSR module does not only give access to SEV_STATUS, but to all MSRs, including those that can affect system stability and security.

@larrydewey

Copy link
Copy Markdown
Contributor

I don't have any arguments against using the sysfs approach. One reason we were leaning so heavily on the MSR implementation is that 1) there was no other implementation, and 2) the MSR in question is a protected MSR. DO you know if the method of providing this through sysfs will be protected from hypervisor modification, as well?

@joergroedel

Copy link
Copy Markdown
Author

I don't have any arguments against using the sysfs approach. One reason we were leaning so heavily on the MSR implementation is that 1) there was no other implementation, and 2) the MSR in question is a protected MSR. DO you know if the method of providing this through sysfs will be protected from hypervisor modification, as well?

There is no change in security by using SYSFS instead of the MSR module, as there is also no guarantee that the MSR module behaves correctly and does actually read the MSR in question.

@DGonzalezVillal

Copy link
Copy Markdown
Member

@joergroedel is this PR ready for merging, I know it's been a while but it's been in Draft for a while?

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