[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/xsaves: get_xsave_addr, check xsave header and support uncompressed format
commit 2a4b84706e5e67be4e3e3a023d4a0a7169b19b45 Author: Huaitong Han <huaitong.han@xxxxxxxxx> AuthorDate: Mon Dec 21 13:37:17 2015 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Mon Dec 21 13:37:17 2015 +0100 x86/xsaves: get_xsave_addr, check xsave header and support uncompressed format The check needs to be against the xsave header in the area, rather than Xen's maximum xfeature_mask. A guest might easily have a smaller xcr0 than the maximum Xen is willing to allow, causing the pointer below to be bogus. The get_xsave_addr() is modified to support uncompressed xstate areas. Signed-off-by: Huaitong Han <huaitong.han@xxxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- xen/arch/x86/xstate.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c index b65da38..4e87ab3 100644 --- a/xen/arch/x86/xstate.c +++ b/xen/arch/x86/xstate.c @@ -146,12 +146,15 @@ static void __init setup_xstate_comp(void) } } -static void *get_xsave_addr(void *xsave, unsigned int xfeature_idx) +static void *get_xsave_addr(struct xsave_struct *xsave, + unsigned int xfeature_idx) { - if ( !((1ul << xfeature_idx) & xfeature_mask) ) + if ( !((1ul << xfeature_idx) & xsave->xsave_hdr.xstate_bv) ) return NULL; - return xsave + xstate_comp_offsets[xfeature_idx]; + return (void *)xsave + (xsave_area_compressed(xsave) + ? xstate_comp_offsets + : xstate_offsets)[xfeature_idx]; } void expand_xsave_states(struct vcpu *v, void *dest, unsigned int size) -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |