On Tue, Sep 19, 2017 at 05:44:34PM -0700, Eric Biggers wrote:
> +/*
> + * We should never get here because the fpregs_state stored in 'struct fpu'
> + * should always be readable and contain a valid FPU state.  However, past 
> bugs
> + * have allowed userspace to set reserved bits in the XSAVE area using
> + * PTRACE_SETREGSET or sys_rt_sigreturn().  These caused XRSTOR to fail when
> + * switching to the task, leaking the FPU registers of the task previously
> + * executing on the CPU.  Mitigate this class of vulnerability by restoring 
> from
> + * the initial state (essentially, zeroing out all the FPU registers) if we
> + * can't restore from the task's FPU state.
> + */
> +void __handle_bad_fpstate(union fpregs_state *fpstate, u64 mask)
> +{
> +     WARN_ONCE(1, "Bad FPU state detected, reinitializing FPU registers");
> +     ____copy_kernel_to_fpregs(&init_fpstate, mask);
> +}

Sorry, a small oversight here --- this needs to be exported to modules, since
kvm can be built as a module, and kvm uses __copy_kernel_to_fpregs().

Eric

Reply via email to