Xen Test Framework
tests
xsa-259
main.c
Go to the documentation of this file.
1
19
#include <xtf.h>
20
21
const
char
test_title
[] =
"XSA-259 PoC"
;
22
23
void
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
*/
ex_record_fault_eax
bool ex_record_fault_eax(struct cpu_regs *regs, const struct extable_entry *ex)
Record the current fault in %eax.
Definition:
extable.c:8
test_main
void test_main(void)
To be implemented by each test, as its entry point.
Definition:
main.c:110
test_title
const char test_title[]
The title of the test.
Definition:
main.c:24
EXINFO_SYM
#define EXINFO_SYM(exc, ec)
Definition:
exinfo.h:29
exinfo_t
unsigned int exinfo_t
Packed exception and error code information.
Definition:
exinfo.h:19
_ASM_EXTABLE_HANDLER
#define _ASM_EXTABLE_HANDLER(fault, fixup, handler)
Create an exception table entry with custom handler.
Definition:
extable.h:38
GP
#define GP
_p
#define _p(v)
Express an abitrary integer v as void *.
Definition:
numbers.h:48
X86_EC_IDT
#define X86_EC_IDT
Definition:
processor.h:156
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
Generated by
1.9.4