Xen Test Framework
main.c
Go to the documentation of this file.
1
20#include <xtf.h>
21
22const char test_title[] = "XSA-193 PoC";
23
24void test_main(void)
25{
26 if ( !wrmsr_safe(MSR_FS_BASE, 0x8000000000000000ull) )
27 xtf_failure("Fail: MSR_FS_BASE didn't fault for non-canonical value\n");
28
29 if ( !wrmsr_safe(MSR_GS_BASE, 0x8000000000000000ull) )
30 xtf_failure("Fail: MSR_GS_BASE didn't fault for non-canonical value\n");
31
32 if ( !wrmsr_safe(MSR_SHADOW_GS_BASE, 0x8000000000000000ull) )
33 xtf_failure("Fail: MSR_SHADOW_GS_BASE didn't fault for non-canonical value\n");
34
35 xtf_success("Success: not vulnerable to XSA-193\n");
36}
37
38/*
39 * Local variables:
40 * mode: C
41 * c-file-style: "BSD"
42 * c-basic-offset: 4
43 * tab-width: 4
44 * indent-tabs-mode: nil
45 * End:
46 */
void test_main(void)
To be implemented by each test, as its entry point.
Definition: main.c:110
const char test_title[]
The title of the test.
Definition: main.c:24
#define MSR_SHADOW_GS_BASE
Definition: msr-index.h:66
#define MSR_GS_BASE
Definition: msr-index.h:65
#define MSR_FS_BASE
Definition: msr-index.h:64
static bool wrmsr_safe(uint32_t idx, uint64_t val)
Wrapper around wrmsr which safely catches #GP[0].
Definition: msr.h:69
void xtf_failure(const char *fmt,...)
Report a test failure.
Definition: report.c:94
void xtf_success(const char *fmt,...)
Report test success.
Definition: report.c:38