Xen Test Framework
tests
xsa-188
main.c
Go to the documentation of this file.
1
18
#include <xtf.h>
19
20
const
char
test_title
[] =
"XSA-188 PoC"
;
21
22
static
uint8_t
array_page
[
PAGE_SIZE
]
__page_aligned_bss
;
23
24
void
test_main
(
void
)
25
{
26
struct
evtchn_init_control
init_control;
27
struct
evtchn_expand_array
expand_array;
28
int
ret;
29
30
/* 1. EVTCHNOP_init_control with bad GFN. */
31
init_control.
control_gfn
= (
uint64_t
)-2;
32
init_control.
offset
= 0;
33
init_control.
vcpu
= 0;
34
35
ret =
hypercall_event_channel_op
(
EVTCHNOP_init_control
, &init_control);
36
if
( ret != -
EINVAL
)
37
xtf_failure
(
"EVTCHNOP_init_control returned %d (!= %d)\n"
, ret, -
EINVAL
);
38
39
/* 2. EVTCHNOP_expand_array. */
40
expand_array.
array_gfn
=
virt_to_gfn
(
array_page
);
41
42
ret =
hypercall_event_channel_op
(
EVTCHNOP_expand_array
, &expand_array);
43
if
( ret != -
ENOSYS
&& ret != -
EOPNOTSUPP
)
44
xtf_failure
(
"EVTCHNOP_expand_array returned %d (!= %d or %d)\n"
,
45
ret, -
ENOSYS
, -
EOPNOTSUPP
);
46
47
xtf_success
(
NULL
);
48
}
49
50
/*
51
* Local variables:
52
* mode: C
53
* c-file-style: "BSD"
54
* c-basic-offset: 4
55
* tab-width: 4
56
* indent-tabs-mode: nil
57
* End:
58
*/
__page_aligned_bss
#define __page_aligned_bss
Definition:
compiler.h:37
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
EINVAL
#define EINVAL
Definition:
errno.h:33
ENOSYS
#define ENOSYS
Definition:
errno.h:43
EOPNOTSUPP
#define EOPNOTSUPP
Definition:
errno.h:51
EVTCHNOP_init_control
#define EVTCHNOP_init_control
Definition:
event_channel.h:8
EVTCHNOP_expand_array
#define EVTCHNOP_expand_array
Definition:
event_channel.h:9
hypercall_event_channel_op
static long hypercall_event_channel_op(unsigned int cmd, void *arg)
Definition:
hypercall.h:167
virt_to_gfn
static unsigned long virt_to_gfn(const void *va)
Definition:
mm.h:100
PAGE_SIZE
#define PAGE_SIZE
Definition:
page.h:11
xtf_failure
void xtf_failure(const char *fmt,...)
Report a test failure.
Definition:
report.c:94
xtf_success
void xtf_success(const char *fmt,...)
Report test success.
Definition:
report.c:38
NULL
#define NULL
Definition:
stddef.h:12
uint64_t
__UINT64_TYPE__ uint64_t
Definition:
stdint.h:17
uint8_t
__UINT8_TYPE__ uint8_t
Definition:
stdint.h:14
evtchn_expand_array
Definition:
event_channel.h:30
evtchn_expand_array::array_gfn
uint64_t array_gfn
Definition:
event_channel.h:32
evtchn_init_control
Definition:
event_channel.h:20
evtchn_init_control::vcpu
uint32_t vcpu
Definition:
event_channel.h:24
evtchn_init_control::offset
uint32_t offset
Definition:
event_channel.h:23
evtchn_init_control::control_gfn
uint64_t control_gfn
Definition:
event_channel.h:22
array_page
static uint8_t array_page[PAGE_SIZE]
Definition:
main.c:22
Generated by
1.9.4