Xen Test Framework
main.c
Go to the documentation of this file.
1
19#include <xtf.h>
20
21const char test_title[] = "XSA-259 PoC";
22
23void test_main(void)
24{
25 exinfo_t fault = 0;
26
27 asm volatile ("1: int $0x80; 2:"
28 _ASM_EXTABLE_HANDLER(1b, 2b, %P[rec])
29 : "+a" (fault)
30 : [rec] "p" (ex_record_fault_eax));
31
32 /*
33 * If Xen is vulnerable, it should have crashed. If Xen is not
34 * vulnerable, we should have got #GP[0x80|IDT] from the attempt to use a
35 * misconfigured IDT entry.
36 */
37 if ( fault != EXINFO_SYM(GP, (0x80 << 3) | X86_EC_IDT) )
38 return xtf_error("Error: Unexpected fault %#x, %pe\n",
39 fault, _p(fault));
40
41 xtf_success("Success: Not vulnerable to XSA-259\n");
42}
43
44/*
45 * Local variables:
46 * mode: C
47 * c-file-style: "BSD"
48 * c-basic-offset: 4
49 * tab-width: 4
50 * indent-tabs-mode: nil
51 * End:
52 */
bool ex_record_fault_eax(struct cpu_regs *regs, const struct extable_entry *ex)
Record the current fault in %eax.
Definition: extable.c:8
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 EXINFO_SYM(exc, ec)
Definition: exinfo.h:29
unsigned int exinfo_t
Packed exception and error code information.
Definition: exinfo.h:19
#define _ASM_EXTABLE_HANDLER(fault, fixup, handler)
Create an exception table entry with custom handler.
Definition: extable.h:38
#define GP
#define _p(v)
Express an abitrary integer v as void *.
Definition: numbers.h:48
#define X86_EC_IDT
Definition: processor.h:156
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