[xen master] xen/domctl: Fix Xen heap leak via XEN_DOMCTL_getvcpucontext
Author: Andrew Cooper <[hidden email]>
AuthorDate: Sun Oct 8 15:12:18 2017 +0100
Commit: Andrew Cooper <[hidden email]>
CommitDate: Mon Oct 9 12:43:21 2017 +0100
xen/domctl: Fix Xen heap leak via XEN_DOMCTL_getvcpucontext
The backing structure for XEN_DOMCTL_getvcpucontext is only zeroed in the x86
HVM case. At the very least, this means that ARM returns junk through its
flags field (as it is only ever conditionally or'd into), and x86 PV leaks
data through gdt_frames[14...15]. (An exhaustive search for other leaks
hasn't been performed).
Unconditionally zero the memory upon allocation, and forgo the double clear
for x86 HVM. These hypercalls are not on hotpaths.
Note that this does not qualify for an XSA. Per XSA-77,
XEN_DOMCTL_getvcpucontext is unsafe for disaggregation, meaning that only the
control domain can use this hypercall.