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: <CALCETrXpGOJpdFnw1oL4HM8VT1cJt=myqHp+HiE1VD2TOF5Gyw@mail.gmail.com>
Date:	Sat, 23 Jan 2016 09:40:06 -0800
From:	Andy Lutomirski <luto@...capital.net>
To:	Borislav Petkov <bp@...en8.de>
Cc:	Andy Lutomirski <luto@...nel.org>, X86 ML <x86@...nel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Fenghua Yu <fenghua.yu@...el.com>,
	Oleg Nesterov <oleg@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Sai Praneeth Prakhya <sai.praneeth.prakhya@...el.com>,
	yu-cheng yu <yu-cheng.yu@...el.com>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	Rik van Riel <riel@...hat.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH 1/5] x86/fpu: Fix math emulation in eager fpu mode

On Sat, Jan 23, 2016 at 2:02 AM, Borislav Petkov <bp@...en8.de> wrote:
> On Fri, Jan 22, 2016 at 04:56:02PM -0800, Andy Lutomirski wrote:
>> Systems without an FPU are generally old and therefore use lazy FPU
>> switching.  Unsurprisingly, math emulation in eager FPU mode is a
>> bit buggy.  Fix it.
>>
>> There were two bugs involving kernel code trying to use the FPU
>> registers in eager mode even if they didn't exist and one BUG_ON
>> that was incorrect.
>>
>> Signed-off-by: Andy Lutomirski <luto@...nel.org>
>> ---
>>  arch/x86/include/asm/fpu/internal.h | 3 ++-
>>  arch/x86/kernel/fpu/core.c          | 2 +-
>>  arch/x86/kernel/traps.c             | 1 -
>>  3 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h
>> index 0fd440df63f1..a1f78a9fbf41 100644
>> --- a/arch/x86/include/asm/fpu/internal.h
>> +++ b/arch/x86/include/asm/fpu/internal.h
>> @@ -589,7 +589,8 @@ switch_fpu_prepare(struct fpu *old_fpu, struct fpu *new_fpu, int cpu)
>>        * If the task has used the math, pre-load the FPU on xsave processors
>>        * or if the past 5 consecutive context-switches used math.
>>        */
>> -     fpu.preload = new_fpu->fpstate_active &&
>> +     fpu.preload = static_cpu_has(X86_FEATURE_FPU) &&
>> +                   new_fpu->fpstate_active &&
>>                     (use_eager_fpu() || new_fpu->counter > 5);
>
> Should we move that static_cpu_has(X86_FEATURE_FPU) check in
> use_eager_fpu()?

I'm confused.  I want to make use_eager_fpu() return true always, so
how would this help?  The idea is for FPU emulation to work despite
being in eager mode.

>
> I mean, when !X86_FEATURE_FPU, then we most certainly aren't doing eager
> FPU anyway.

With this patch applied, we can do eager fpu without X86_FEATURE_FPU :)

--Andy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ