Xen Test Framework
main.c
Go to the documentation of this file.
1 
18 #include <xtf.h>
19 
20 const char test_title[] = "XSA-188 PoC";
21 
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 
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 
43  if ( ret != -ENOSYS && ret != -EOPNOTSUPP )
44  xtf_failure("EVTCHNOP_expand_array returned %d (!= %d or %d)\n",
45  ret, -ENOSYS, -EOPNOTSUPP);
46 
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  */
#define EINVAL
Definition: errno.h:33
#define __page_aligned_bss
Definition: compiler.h:37
static uint8_t array_page[PAGE_SIZE]
Definition: main.c:22
#define ENOSYS
Definition: errno.h:43
#define EOPNOTSUPP
Definition: errno.h:51
#define EVTCHNOP_expand_array
Definition: event_channel.h:9
#define NULL
Definition: stddef.h:12
void xtf_success(const char *fmt,...)
Report test success.
Definition: report.c:38
void xtf_failure(const char *fmt,...)
Report a test failure.
Definition: report.c:94
void test_main(void)
To be implemented by each test, as its entry point.
Definition: main.c:137
__UINT64_TYPE__ uint64_t
Definition: stdint.h:17
static unsigned long virt_to_gfn(const void *va)
Definition: mm.h:100
static long hypercall_event_channel_op(unsigned int cmd, void *arg)
Definition: hypercall.h:167
#define EVTCHNOP_init_control
Definition: event_channel.h:8
const char test_title[]
The title of the test.
Definition: main.c:14
#define PAGE_SIZE
Definition: page.h:11
__UINT8_TYPE__ uint8_t
Definition: stdint.h:14