Re: [PATCH RFC v1 02/11] x86/fpu/xstate: Introduce xstate order table and accessor macro

From: Ingo Molnar
Date: Thu Feb 27 2025 - 15:02:39 EST



* Dave Hansen <dave.hansen@xxxxxxxxx> wrote:

> On 2/27/25 11:36, Ingo Molnar wrote:
> >
> >> There were basically three choices:
> >>
> >> 1. Reuse XFEATURES 3/4 (MPX)
> >> 2. Create a new out-of-order XFEATURE 19 that reuses MPX space
> >> 3. Create a n in-order XFEATURE 19 that needs XFD and an opt-in
> >>
> >> #1 risks breaking old MPX code in weird ways.
> > This is a false trichotomy. 😉
> >
> > There's a 4th option:
> >
> > 4. Reuse XFEATURES 3/4 (MPX) only on APX-aware kernels, keep it
> > disabled for old kernels.
> >
> > Problem solved.
>
> The worry boils down to code in the kernel or userspace doing this:
>
> if (XGETBV(0) & 0x11)
> do_mpx_gunk();

New, APX-aware kernels wouldn't be doing this, why would they?

> So, sure, we could try to make sure that new kernels don't have any
> do_mpx_gunk() in them, but that doesn't help old kernels or other
> OSes/VMMs.

Old kernels would *never* see this bit enabled if it's disabled by
default on bootup ...

VMMs would boot with it default-disabled as well, they can enable it
themselves.

Thanks,

Ingo