From: Dave Hansen <dave.hansen@linux.intel.com>
To: Eric Biggers <ebiggers3@gmail.com>, x86@kernel.org
Cc: linux-kernel@vger.kernel.org,
kernel-hardening@lists.openwall.com,
Andy Lutomirski <luto@kernel.org>,
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: Re: [PATCH v2 2/3] x86/fpu: tighten validation of user-supplied xstate_header
Date: Wed, 20 Sep 2017 08:54:33 -0700 [thread overview]
Message-ID: <f5387b72-0c2d-0603-b630-2aca25d16ccb@linux.intel.com> (raw)
In-Reply-To: <20170920004434.35308-3-ebiggers3@gmail.com>
On 09/19/2017 05:44 PM, Eric Biggers wrote:
> +static inline int validate_xstate_header(const struct xstate_header *hdr)
> +{
> + /* No unknown or supervisor features may be set */
> + if (hdr->xfeatures & (~xfeatures_mask | XFEATURE_MASK_SUPERVISOR))
> + return -EINVAL;
> +
> + /* Userspace must use the uncompacted format */
> + if (hdr->xcomp_bv)
> + return -EINVAL;
> +
> + /* No reserved bits may be set */
> + if (memchr_inv(hdr->reserved, 0, sizeof(hdr->reserved)))
> + return -EINVAL;
> +
> + return 0;
> +}
BTW, the whole series looks pretty sane to me. Tou're definitely
leaving the code better than you found it. Feel free to add my acked-by
on all 3 patches.
One nit about this validate function, though. Let's say we go and
change 'struct xstate_header' and shrink ->reserved because we add a new
field. This validator will silently break.
Could we add a
BUILD_BUG_ON(sizeof(hdr->reserved) != 48);
That way, the next hapless kernel developer can't miss updating this.
next prev parent reply other threads:[~2017-09-20 15:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-20 0:44 [PATCH v2 0/3] x86/fpu: prevent leaking FPU registers via invalid FPU state Eric Biggers
2017-09-20 0:44 ` [PATCH v2 1/3] x86/fpu: don't let userspace set bogus xcomp_bv Eric Biggers
2017-09-26 2:15 ` [lkp-robot] [x86/fpu] 14e633085a: Kernel_panic-not_syncing:Attempted_to_kill_init!exitcode= kernel test robot
2017-09-26 3:02 ` Eric Biggers
2017-09-20 0:44 ` [PATCH v2 2/3] x86/fpu: tighten validation of user-supplied xstate_header Eric Biggers
2017-09-20 15:54 ` Dave Hansen [this message]
2017-09-20 0:44 ` [PATCH v2 3/3] x86/fpu: reinitialize FPU registers if restoring FPU state fails Eric Biggers
2017-09-20 3:18 ` Eric Biggers
2017-09-20 15:41 ` Andy Lutomirski
2017-09-22 17:05 ` kbuild test robot
2017-09-20 3:03 ` [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=f5387b72-0c2d-0603-b630-2aca25d16ccb@linux.intel.com \
--to=dave.hansen@linux.intel.com \
--cc=dvyukov@google.com \
--cc=ebiggers3@gmail.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
Powered by JetHome