Re: [PATCH v5 14/28] x86/fpu/xstate: Prevent unauthorised use of dynamic user state
From: Dave Hansen
Date: Tue Jun 29 2021 - 15:27:02 EST
On 6/29/21 12:13 PM, Bae, Chang Seok wrote:
>>
>> Is it actually important to make sure that they are dynamic features?
>> Is there *any* case where a feature (dynamic or not) can have XFD armed
>> and be out of its init state?
> In this AMX series, XFD is only used for the xstate buffer management. The
> code is made in a such way that XFD and dynamic states are a bit coupled.
>
> But I think XFD can be extended for other usages in the future. Then, yes.
> (This warning is also for future code changes.)
>
> So, reading the MSR is just simple and clean here, but it consumes cycles. Or,
> a task may have a field for XFD value per se unless this conversion is
> acceptable.
I'm not following.
All that I see here is that you made what could be a very generic check:
Thou shalt never XSAVE a xfeature which is XFD-armed
and made it more specific:
Thou shalt never XSAVE a *dynamic* xfeature which is XFD-armed
I'm just saying that I don't see the value in a less-broad check. Let's
make the sanity check as broad as possible. That actually makes the
code simpler.