Skip to content

Commit 7fc1576

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

3 files changed

Lines changed: 38 additions & 0 deletions

File tree

tests/host_sb/__init__.py

Whitespace-only changes.
24.8 KB
Binary file not shown.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import logging
2+
import pathlib
3+
from unittest import result
4+
5+
import pytest
6+
7+
from lib.host import Host
8+
9+
log = logging.getLogger(__name__)
10+
11+
# Requirements:
12+
# - one XCP-ng host (--host) >= 9.0
13+
# - Host Secureboot enforcement must be enabled
14+
15+
def test_hypercall_filter(host: Host):
16+
"""
17+
Verify the Xen privcmd hypercall filter.
18+
19+
The helper binary performs a collection of safe hypercalls and verifies
20+
that:
21+
* allowed read-only hypercalls succeed
22+
* invalid guest pointers are rejected with -EFAULT
23+
* forbidden operations are rejected by the filter
24+
* unknown operations return the expected error
25+
26+
The helper exits with status 0 iff every check passes.
27+
"""
28+
29+
local_binary = pathlib.Path(__file__).parent / "data" / "test_hypercall_filter"
30+
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)
36+
37+
result = host.ssh_with_result(remote_binary)
38+
assert result.returncode == 0, result.stdout

0 commit comments

Comments
 (0)