-
Notifications
You must be signed in to change notification settings - Fork 10
Add hypercall_filter.py test under host_sb for 9.0 #637
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import pathlib | ||
|
|
||
| import pytest | ||
|
|
||
| from lib.host import Host | ||
|
|
||
| # Requirements: | ||
| # - one XCP-ng host (--host) >= 9.0 | ||
| # - Host Secureboot enforcement must be enabled | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is the case, you should verify it with a fixture. Optionally, also check if the Secure Boot keys etc. are in place. |
||
|
|
||
| def test_hypercall_filter(host: Host): | ||
|
|
||
| """ | ||
| Verify the Xen privcmd hypercall filter. | ||
|
|
||
| The helper binary performs a collection of safe hypercalls and verifies | ||
| that: | ||
| * allowed read-only hypercalls succeed | ||
| * invalid guest pointers are rejected with -EFAULT | ||
| * forbidden operations are rejected by the filter | ||
| * unknown operations return the expected error | ||
|
|
||
| The helper exits with status 0 iff every check passes. | ||
| """ | ||
|
|
||
| state = host.ssh("mokutil --sb-state", simple_output=True) | ||
| if "SecureBoot enabled" not in state: | ||
| pytest.skip("Secure Boot is disabled") | ||
|
|
||
| local_binary = pathlib.Path(__file__).parent / "data" / "test_hypercall_filter" | ||
| remote_binary = "/tmp/test_hypercall_filter" | ||
|
Comment on lines
+30
to
+31
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's worth discussing a better way to produce and host this sort of test binaries. At least, this test should link to the relevant tool repo. |
||
|
|
||
| host.scp(str(local_binary), remote_binary) | ||
| host.ssh(f"chmod +x {remote_binary}") | ||
| host.ssh(remote_binary) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this test go into
tests/xenor is it better as a separate component?