Xen Test Framework
main.c
Go to the documentation of this file.
1
15#include <xtf.h>
16
17const char test_title[] = "XSA-472-2 PoC";
18
19#define HV_X64_MSR_STIMER0_CONFIG 0x400000B0
20#define HV_X64_MSR_STIMER0_COUNT 0x400000B1
21
22void test_main(void)
23{
24 int rc = apic_init(APIC_MODE_XAPIC);
25
26 if ( rc )
27 return xtf_error("Error: unable to init APIC: %d\n", rc);
28
29 /*
30 * Test if using Synthetic Timers assumes the SIM page to be
31 * unconditionally mapped.
32 */
34 wrmsr(HV_X64_MSR_STIMER0_CONFIG, (1 << 16) | 1);
35
36 /*
37 * If we're still alive here, Xen didn't crash, so the NULL pointer
38 * dereference is not present.
39 */
40 xtf_success("Success: Not vulnerable to XSA-470 (CVE-2025-58142)\n");
41}
42
43/*
44 * Local variables:
45 * mode: C
46 * c-file-style: "BSD"
47 * c-basic-offset: 4
48 * tab-width: 4
49 * indent-tabs-mode: nil
50 * End:
51 */
int apic_init(enum apic_mode mode)
Discover and initialise the local APIC to the requested mode.
Definition: apic.c:33
@ APIC_MODE_XAPIC
Definition: apic.h:45
void test_main(void)
To be implemented by each test, as its entry point.
Definition: main.c:301
const char test_title[]
The title of the test.
Definition: main.c:13
static void wrmsr(uint32_t idx, uint64_t val)
Thin wrapper around an wrmsr instruction.
Definition: msr.h:55
void xtf_error(const char *fmt,...)
Report a test error.
Definition: report.c:80
void xtf_success(const char *fmt,...)
Report test success.
Definition: report.c:38
#define HV_X64_MSR_STIMER0_CONFIG
Definition: main.c:19
#define HV_X64_MSR_STIMER0_COUNT
Definition: main.c:20