Re: [PATCH 15/23] x86/fpu: Add sanity checks for XFD

From: Borislav Petkov
Date: Mon Oct 25 2021 - 04:11:25 EST


On Thu, Oct 21, 2021 at 03:55:19PM -0700, Chang S. Bae wrote:
> @@ -217,12 +240,15 @@ static inline int xrstor_from_user_sigframe(struct xregs_state __user *buf, u64
> * Restore xstate from kernel space xsave area, return an error code instead of
> * an exception.
> */
> -static inline int os_xrstor_safe(struct xregs_state *xstate, u64 mask)
> +static inline int os_xrstor_safe(struct fpstate *fpstate, u64 mask)
> {
> + struct xregs_state *xstate = &fpstate->regs.xsave;
> u32 lmask = mask;
> u32 hmask = mask >> 32;
> int err;
>
> + /* Must enforce XFD update here */
> +

<--- something's missing here?

> if (cpu_feature_enabled(X86_FEATURE_XSAVES))
> XSTATE_OP(XRSTORS, xstate, lmask, hmask, err);
> else
> --
> 2.17.1
>

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette