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


Groups > linux.kernel > #1730502 > unrolled thread

Re: [PATCH] x86/fpu: don't let PTRACE_SETREGSET set xcomp_bv

Started byDave Hansen <dave.hansen@linux.intel.com>
First post2017-09-11 22:00 +0200
Last post2017-09-11 22:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] x86/fpu: don't let PTRACE_SETREGSET set xcomp_bv Dave Hansen <dave.hansen@linux.intel.com> - 2017-09-11 22:00 +0200

#1730502 — Re: [PATCH] x86/fpu: don't let PTRACE_SETREGSET set xcomp_bv

FromDave Hansen <dave.hansen@linux.intel.com>
Date2017-09-11 22:00 +0200
SubjectRe: [PATCH] x86/fpu: don't let PTRACE_SETREGSET set xcomp_bv
Message-ID<uoD29-7Me-9@gated-at.bofh.it>
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.

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web