[xen stable-4.7] xen/domctl: Fix Xen heap leak via XEN_DOMCTL_getvcpucontext
Author: Andrew Cooper <[hidden email]>
AuthorDate: Tue Oct 24 16:42:13 2017 +0200
Commit: Jan Beulich <[hidden email]>
CommitDate: Tue Oct 24 16:42:13 2017 +0200
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.