Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1735412

Re: [PATCH v2 3/3] x86/fpu: reinitialize FPU registers if restoring FPU state fails

From Eric Biggers <ebiggers3@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 3/3] x86/fpu: reinitialize FPU registers if restoring FPU state fails
Date 2017-09-20 05:20 +0200
Message-ID <urDIl-5IT-3@gated-at.bofh.it> (permalink)
References <urBnb-42V-5@gated-at.bofh.it> <urBnb-42V-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 3/3] x86/fpu: reinitialize FPU registers if restoring FPU state fails Eric Biggers <ebiggers3@gmail.com> - 2017-09-20 02:50 +0200
  Re: [PATCH v2 3/3] x86/fpu: reinitialize FPU registers if restoring  FPU state fails Eric Biggers <ebiggers3@gmail.com> - 2017-09-20 05:20 +0200
  Re: [PATCH v2 3/3] x86/fpu: reinitialize FPU registers if restoring  FPU state fails Andy Lutomirski <luto@kernel.org> - 2017-09-20 17:50 +0200
  Re: [PATCH v2 3/3] x86/fpu: reinitialize FPU registers if restoring  FPU state fails kbuild test robot <lkp@intel.com> - 2017-09-22 19:00 +0200

csiph-web