Skip to content

Commit 5caecf9

Browse files
committed
Add hypercall_filter.py test under host_sb for 9.0
1 parent b15615c commit 5caecf9

3 files changed

Lines changed: 35 additions & 0 deletions

File tree

tests/host_sb/__init__.py

Whitespace-only changes.
24.8 KB
Binary file not shown.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import pathlib
2+
3+
import pytest
4+
5+
from lib.host import Host
6+
7+
# Requirements:
8+
# - one XCP-ng host (--host) >= 9.0
9+
# - Host Secureboot enforcement must be enabled
10+
11+
def test_hypercall_filter(host: Host):
12+
13+
"""
14+
Verify the Xen privcmd hypercall filter.
15+
16+
The helper binary performs a collection of safe hypercalls and verifies
17+
that:
18+
* allowed read-only hypercalls succeed
19+
* invalid guest pointers are rejected with -EFAULT
20+
* forbidden operations are rejected by the filter
21+
* unknown operations return the expected error
22+
23+
The helper exits with status 0 iff every check passes.
24+
"""
25+
26+
state = host.ssh("mokutil --sb-state", simple_output=True)
27+
if "SecureBoot enabled" not in state:
28+
pytest.skip("Secure Boot is disabled")
29+
30+
local_binary = pathlib.Path(__file__).parent / "data" / "test_hypercall_filter"
31+
remote_binary = "/tmp/test_hypercall_filter"
32+
33+
host.scp(str(local_binary), remote_binary)
34+
host.ssh(f"chmod +x {remote_binary}")
35+
host.ssh(remote_binary)

0 commit comments

Comments
 (0)