Xen Test Framework
tests
xsa-167
main.c
Go to the documentation of this file.
1
28
#include <xtf.h>
29
30
const
char
test_title
[] =
"XSA-167 PoC"
;
31
32
void
test_main
(
void
)
33
{
34
mmuext_op_t
op =
35
{
36
.
cmd
=
MMUEXT_MARK_SUPER
,
37
.arg1.mfn = (-1ULL <<
L2_PT_SHIFT
),
38
};
39
40
printk
(
" Attempting to mark mfn %#lx as a superpage\n"
, op.
arg1
.
mfn
);
41
int
rc =
hypercall_mmuext_op
(&op, 1,
NULL
,
DOMID_SELF
);
42
43
switch
( rc )
44
{
45
case
-
ENOSYS
:
46
case
-
EOPNOTSUPP
:
47
return
xtf_skip
(
"PV superpage support not detected\n"
);
48
49
case
-
EINVAL
:
50
return
xtf_success
(
"Xen correctly rejected the bogus mark attempt\n"
);
51
52
case
0:
53
return
xtf_failure
(
"Marking bogus superpage succeeded\n"
);
54
55
default
:
56
return
xtf_error
(
"Unexpected error %d\n"
, rc);
57
}
58
}
59
60
/*
61
* Local variables:
62
* mode: C
63
* c-file-style: "BSD"
64
* c-basic-offset: 4
65
* tab-width: 4
66
* indent-tabs-mode: nil
67
* End:
68
*/
printk
void printk(const char *fmt,...)
Definition:
console.c:134
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
hypercall_mmuext_op
static long hypercall_mmuext_op(const mmuext_op_t ops[], unsigned int count, unsigned int *done, unsigned int foreigndom)
Definition:
hypercall.h:148
L2_PT_SHIFT
#define L2_PT_SHIFT
Definition:
page.h:67
xtf_failure
void xtf_failure(const char *fmt,...)
Report a test failure.
Definition:
report.c:94
xtf_error
void xtf_error(const char *fmt,...)
Report a test error.
Definition:
report.c:80
xtf_skip
void xtf_skip(const char *fmt,...)
Report a test skip.
Definition:
report.c:66
xtf_success
void xtf_success(const char *fmt,...)
Report test success.
Definition:
report.c:38
NULL
#define NULL
Definition:
stddef.h:12
mmuext_op
Definition:
xen.h:355
mmuext_op::cmd
unsigned int cmd
Definition:
xen.h:356
mmuext_op::mfn
xen_pfn_t mfn
Definition:
xen.h:360
mmuext_op::arg1
union mmuext_op::@51 arg1
DOMID_SELF
#define DOMID_SELF
Definition:
xen.h:70
MMUEXT_MARK_SUPER
#define MMUEXT_MARK_SUPER
Definition:
xen.h:351
Generated by
1.9.4