Re: [PATCH v9 12/26] x86/fpu/xstate: Use feature disable (XFD) to protect dynamic user state

Thiago Macieira
2021-08-18T22:27:46Z

On Wednesday, 18 August 2021 14:12:06 PDT Bae, Chang Seok wrote:
> On Aug 18, 2021, at 14:04, Thiago Macieira <thiago.macieira@intel.com>
> wrote:
> > But it's not the only possible solution. A future kernel could decide to
> > leave some bits off and only enable upon request. That's how
> > macOS/Darwin does its AVX512 support.
>
>
> Even if XCR0 is ever switched, doesn’t XGETBV(0) return it for the
> *current* task?

That's the point. If the kernel decides that feature bit 19 will be left off
in XCR0, how shall userspace know the kernel supports the feature through the
arch_prctl syscall you added?

Not that I am advising we adopt this strategy. We don't need more
fragmentation on how we enable the features. But having this syscall gives us
flexibility in case we do need it in the future.

--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel DPG Cloud Engineering