lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YMsPCyL8YkT9W+9o@zn.tnic>
Date:   Thu, 17 Jun 2021 10:59:55 +0200
From:   Borislav Petkov <bp@...e.de>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Andy Lutomirski <luto@...nel.org>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Fenghua Yu <fenghua.yu@...el.com>,
        Tony Luck <tony.luck@...el.com>,
        Yu-cheng Yu <yu-cheng.yu@...el.com>,
        Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
        Peter Zijlstra <peterz@...radead.org>,
        Kan Liang <kan.liang@...ux.intel.com>
Subject: Re: [patch V2 15/52] x86/fpu: Use copy_uabi_xstate_to_membuf() in
 xfpregs_get()

On Mon, Jun 14, 2021 at 05:44:23PM +0200, Thomas Gleixner wrote:
> Use the new functionality of copy_uabi_xstate_to_membuf() to retrieve the
> FX state when XSAVE* is in use. This avoids to overwrite the FPU state

					avoids overwriting...

> buffer with fpstate_sanitize_xstate() which is error prone and duplicated
> code.
> 
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> ---
> V2: New patch
> ---
>  arch/x86/kernel/fpu/regset.c |   11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> --- a/arch/x86/kernel/fpu/regset.c
> +++ b/arch/x86/kernel/fpu/regset.c
> @@ -33,13 +33,18 @@ int xfpregs_get(struct task_struct *targ

So AFAICT, this thing is called by PTRACE_GETFPREGS but looking at ltp:

$ git grep PTRACE_GETFPREGS
$

so this is used - if at all used - by some super duper old binaries
somewhere.

manpage says "PTRACE_GETREGS and PTRACE_GETFPREGS are not present on all
architectures." which could explain why. I wonder if we should add some
stupid test cases so that we can at least exercise this...

>  	struct fpu *fpu = &target->thread.fpu;
>  
> -	if (!boot_cpu_has(X86_FEATURE_FXSR))
> +	if (!static_cpu_has(X86_FEATURE_FXSR))

cpu_feature_enabled

>  		return -ENODEV;
>  
>  	fpu__prepare_read(fpu);
> -	fpstate_sanitize_xstate(fpu);
>  
> -	return membuf_write(&to, &fpu->state.fxsave, sizeof(struct fxregs_state));
> +	if (!use_xsave()) {
> +		return membuf_write(&to, &fpu->state.fxsave,
> +				    sizeof(fpu->state.fxsave));
> +	}
> +
> +	copy_uabi_xstate_to_membuf(to, &fpu->state.xsave, XSTATE_COPY_FX);
> +	return 0;

With the above nitpicks addressed:

Reviewed-by: Borislav Petkov <bp@...e.de>

Thx.

-- 
Regards/Gruss,
    Boris.

SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ