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]
Date:	Wed, 5 Oct 2011 12:53:17 -0700
From:	"Yu, Fenghua" <fenghua.yu@...el.com>
To:	Thomas Gleixner <tglx@...utronix.de>
CC:	Ingo Molnar <mingo@...e.hu>, H Peter Anvin <hpa@...or.com>,
	"Luck, Tony" <tony.luck@...el.com>,
	"Mallick, Asit K" <asit.k.mallick@...el.com>,
	"Siddha, Suresh B" <suresh.b.siddha@...el.com>,
	"Brown, Len" <len.brown@...el.com>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 3/8] x86, i387.c: thread xstate is initialized only on
 BSP once

> -----Original Message-----
> From: Thomas Gleixner [mailto:tglx@...utronix.de]
> Sent: Wednesday, October 05, 2011 11:50 AM
> To: Yu, Fenghua
> Cc: Ingo Molnar; H Peter Anvin; Zwane Mwaikambo; Luck, Tony; Mallick,
> Asit K; Siddha, Suresh B; Len Brown; linux-kernel
> Subject: Re: [PATCH 3/8] x86, i387.c: thread xstate is initialized only
> on BSP once
> 
> On Wed, 5 Oct 2011, Fenghua Yu wrote:
> 
> > From: Fenghua Yu <fenghua.yu@...el.com>
> >
> > init_thread_xstate() is only called on BSP once to avoid to override
> > xstate_size.
> >
> > Signed-off-by: Fenghua Yu <fenghua.yu@...el.com>
> > ---
> >  arch/x86/kernel/i387.c |    9 ++++++++-
> >  1 files changed, 8 insertions(+), 1 deletions(-)
> >
> > diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
> > index 739d859..de2b48a 100644
> > --- a/arch/x86/kernel/i387.c
> > +++ b/arch/x86/kernel/i387.c
> > @@ -93,6 +93,7 @@ void __cpuinit fpu_init(void)
> >  {
> >  	unsigned long cr0;
> >  	unsigned long cr4_mask = 0;
> > +	static int once;
> >
> >  	if (cpu_has_fxsr)
> >  		cr4_mask |= X86_CR4_OSFXSR;
> > @@ -107,8 +108,14 @@ void __cpuinit fpu_init(void)
> >  		cr0 |= X86_CR0_EM;
> >  	write_cr0(cr0);
> >
> > -	if (!smp_processor_id())
> > +	/*
> > +	 * init_thread_xstate is only called on BSP once to avoid to
> override
> > +	 * xstate_size.
> > +	 */
> > +	if (!smp_processor_id() && once) {
> 
> Brilliant change. Makes sure that init_thread_xstate() is NEVER
> called. Was this crap tested at all?

Ooh, "once" should be initialized as 1.

The code passes stress test with CPU0 online/offline, though...xstate_size will be re-initialized/overriden in xstate_enable_boot_cpu() later. So not calling init_thread_xstate() doesn't cause problem in my situation (where HAVE_HWFP=1).

Anyway, this patch is wrong. I'll fix it in next version.

Thanks.

-Fenghua
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ