From: Dave Hansen <dave.hansen@linux.intel.com>
To: Eric Biggers <ebiggers3@gmail.com>, x86@kernel.org
Cc: linux-kernel@vger.kernel.org, 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>,
stable@vger.kernel.org
Subject: Re: [PATCH] x86/fpu: don't let PTRACE_SETREGSET set xcomp_bv
Date: Mon, 11 Sep 2017 12:51:21 -0700 [thread overview]
Message-ID: <e23a2ccb-095f-c6eb-4857-d0083454cc29@linux.intel.com> (raw)
In-Reply-To: <20170908164955.41784-1-ebiggers3@gmail.com>
On 09/08/2017 09:49 AM, Eric Biggers wrote:
> diff --git a/arch/x86/kernel/fpu/regset.c b/arch/x86/kernel/fpu/regset.c
> index b188b16841e3..718b791bc037 100644
> --- a/arch/x86/kernel/fpu/regset.c
> +++ b/arch/x86/kernel/fpu/regset.c
> @@ -131,11 +131,15 @@ int xstateregs_set(struct task_struct *target, const struct user_regset *regset,
>
> fpu__activate_fpstate_write(fpu);
>
> - if (boot_cpu_has(X86_FEATURE_XSAVES))
> + if (boot_cpu_has(X86_FEATURE_XSAVES)) {
> ret = copyin_to_xsaves(kbuf, ubuf, xsave);
> - else
> + } else {
> ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, xsave, 0, -1);
>
> + /* xcomp_bv must be zero when using uncompacted format */
> + xsave->header.xcomp_bv = 0;
> + }
Thanks for finding this!
I wonder if just writing over the user arguments is the right thing
here. It's quite conceivable that userspace has a *real* compacted
(XSAVEC-generated) buffer. Doing this could still end up corrupting data.
I think we probably (re?) define NT_X86_XSTATE as being for uncompacted
state only. Then, return an error back to userspace to tell them they
tried to do something we can't support.
We might even want to check all the reserved bits in the uncompacted
XSAVE header and enforce that they come in as zero.
prev parent reply other threads:[~2017-09-11 19:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-08 16:49 [PATCH] x86/fpu: don't let PTRACE_SETREGSET set xcomp_bv Eric Biggers
2017-09-11 19:51 ` Dave Hansen [this message]
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=e23a2ccb-095f-c6eb-4857-d0083454cc29@linux.intel.com \
--to=dave.hansen@linux.intel.com \
--cc=dvyukov@google.com \
--cc=ebiggers3@gmail.com \
--cc=fenghua.yu@intel.com \
--cc=haokexin@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=stable@vger.kernel.org \
--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