From: Eric Biggers <ebiggers3@gmail.com>
To: x86@kernel.org
Cc: linux-kernel@vger.kernel.org,
kernel-hardening@lists.openwall.com,
Andy Lutomirski <luto@kernel.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
Dmitry Vyukov <dvyukov@google.com>,
Fenghua Yu <fenghua.yu@intel.com>, Ingo Molnar <mingo@kernel.org>,
Kevin Hao <haokexin@gmail.com>, Oleg Nesterov <oleg@redhat.com>,
Wanpeng Li <wanpeng.li@hotmail.com>,
Yu-cheng Yu <yu-cheng.yu@intel.com>,
Michael Halcrow <mhalcrow@google.com>,
Eric Biggers <ebiggers@google.com>
Subject: [kernel-hardening] Re: [PATCH v2 3/3] x86/fpu: reinitialize FPU registers if restoring FPU state fails
Date: Tue, 19 Sep 2017 20:18:28 -0700 [thread overview]
Message-ID: <20170920031828.GA537@zzz.localdomain> (raw)
In-Reply-To: <20170920004434.35308-4-ebiggers3@gmail.com>
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
next prev parent reply other threads:[~2017-09-20 3:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-20 0:44 [kernel-hardening] [PATCH v2 0/3] x86/fpu: prevent leaking FPU registers via invalid FPU state Eric Biggers
2017-09-20 0:44 ` [kernel-hardening] [PATCH v2 1/3] x86/fpu: don't let userspace set bogus xcomp_bv Eric Biggers
2017-09-26 2:15 ` [kernel-hardening] [lkp-robot] [x86/fpu] 14e633085a: Kernel_panic-not_syncing:Attempted_to_kill_init!exitcode= kernel test robot
2017-09-26 3:02 ` [kernel-hardening] " Eric Biggers
2017-09-20 0:44 ` [kernel-hardening] [PATCH v2 2/3] x86/fpu: tighten validation of user-supplied xstate_header Eric Biggers
2017-09-20 15:54 ` [kernel-hardening] " Dave Hansen
2017-09-20 0:44 ` [kernel-hardening] [PATCH v2 3/3] x86/fpu: reinitialize FPU registers if restoring FPU state fails Eric Biggers
2017-09-20 3:18 ` Eric Biggers [this message]
2017-09-20 15:41 ` [kernel-hardening] " Andy Lutomirski
2017-09-22 17:05 ` kbuild test robot
2017-09-20 3:03 ` [kernel-hardening] Re: [PATCH v2 0/3] x86/fpu: prevent leaking FPU registers via invalid FPU state Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170920031828.GA537@zzz.localdomain \
--to=ebiggers3@gmail.com \
--cc=dave.hansen@linux.intel.com \
--cc=dvyukov@google.com \
--cc=ebiggers@google.com \
--cc=fenghua.yu@intel.com \
--cc=haokexin@gmail.com \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mhalcrow@google.com \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=wanpeng.li@hotmail.com \
--cc=x86@kernel.org \
--cc=yu-cheng.yu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).