[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 for-4.7] x86/cpuid: Calculate a guests xfeature_mask from its featureset



On 03/06/16 15:11, Andrew Cooper wrote:
> libxc current performs the xstate calculation for guests, and provides the
> information to Xen to be used when satisfying CPUID traps.  (There is further
> work planned to improve this arrangement, but the worst a buggy toolstack can
> do is make junk appear in the cpuid leaves for the guest.)
>
> dom0 however has no policy constructed for it, and certain fields filter
> straight through from hardware.
>
> Linux queries CPUID.7[0].{EAX/EDX} alone to choose a setting for %xcr0, which
> is a valid action to take, but features such as MPX and PKRU are not supported
> for PV guests.  As a result, Linux, using leaked hardware information, fails
> to set %xcr0 on newer Skylake hardware with PKRU support, and crashes.
>
> As an interim solution, dynamically calculate the correct xfeature_mask and
> xstate_size to report to the guest for CPUID.7[0] queries.  This ensures that
> domains don't see leaked hardware values, even when no cpuid policy is
> provided.
>
> Similarly, CPUID.7[1]{ECX/EDX} represents the applicable settings for MSR_XSS.
> As Xen doesn't yet support any XSS states in guests, unconditionally zero
> them.

(sadly after pushing), it occurs to me that commit message is wrong.  I
mean CPUID.0xD rather than CPUID.7

The code, and other information in the commit message, is correct.

Apologies.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.