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: <CAMzpN2iHYs1UO6RCXRQg0g6pvgRCCP9MQ-at0fTELvVAhbJ6Jw@mail.gmail.com>
Date:	Tue, 5 Apr 2016 09:51:55 -0400
From:	Brian Gerst <brgerst@...il.com>
To:	Borislav Petkov <bp@...en8.de>
Cc:	X86 ML <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/6] x86/fpu/regset: Use boot_cpu_has()

On Tue, Apr 5, 2016 at 2:29 AM, Borislav Petkov <bp@...en8.de> wrote:
> From: Borislav Petkov <bp@...e.de>
>
> fpregs_{g,s}et() are not sizzling-hot paths to justify the need for
> static_cpu_has(). Use the normal boot_cpu_has() helper.
>
> Signed-off-by: Borislav Petkov <bp@...e.de>
> ---
>  arch/x86/kernel/fpu/regset.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kernel/fpu/regset.c b/arch/x86/kernel/fpu/regset.c
> index bc5e76c1d7c5..81422dfb152b 100644
> --- a/arch/x86/kernel/fpu/regset.c
> +++ b/arch/x86/kernel/fpu/regset.c
> @@ -278,7 +278,7 @@ int fpregs_get(struct task_struct *target, const struct user_regset *regset,
>
>         fpu__activate_fpstate_read(fpu);
>
> -       if (!static_cpu_has(X86_FEATURE_FPU))
> +       if (!boot_cpu_has(X86_FEATURE_FPU))
>                 return fpregs_soft_get(target, regset, pos, count, kbuf, ubuf);
>
>         if (!boot_cpu_has(X86_FEATURE_FXSR))
> @@ -309,7 +309,7 @@ int fpregs_set(struct task_struct *target, const struct user_regset *regset,
>         fpu__activate_fpstate_write(fpu);
>         fpstate_sanitize_xstate(fpu);
>
> -       if (!static_cpu_has(X86_FEATURE_FPU))
> +       if (!boot_cpu_has(X86_FEATURE_FPU))
>                 return fpregs_soft_set(target, regset, pos, count, kbuf, ubuf);
>
>         if (!boot_cpu_has(X86_FEATURE_FXSR))

I think the general rule should be always use static_cpu_has() for
runtime checks, since it reduces down to a single jmp/nop instruction
after alternatives run.  Even if it's not a hot path, it saves a bit
of runtime memory.  boot_cpu_has() is fine for run-once init code.

--
Brian Gerst

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ