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: <20150129215638.GB1045@redhat.com>
Date:	Thu, 29 Jan 2015 22:56:38 +0100
From:	Oleg Nesterov <oleg@...hat.com>
To:	Dave Hansen <dave.hansen@...ux.intel.com>
Cc:	Rik van Riel <riel@...hat.com>, Suresh Siddha <sbsiddha@...il.com>,
	Andy Lutomirski <luto@...capital.net>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	Fenghua Yu <fenghua.yu@...el.com>,
	the arch/x86 maintainers <x86@...nel.org>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 0/3]: x86, fpu: unlazy_fpu fixes/cleanups

On 01/29, Dave Hansen wrote:
>
> On 01/29/2015 01:33 PM, Oleg Nesterov wrote:
> > On 01/29, Dave Hansen wrote:
> >>
> >> On 01/29/2015 01:07 PM, Oleg Nesterov wrote:
> >>> On 01/23, Rik van Riel wrote:
> >>>>> Not only is this broken with my new code, but it looks like it may
> >>>>> be broken with the current code, too...
> >>> Lets (try to) fix unlazy_fpu/save_init_fpu at least.
> >>>
> >>> Dave, fpu_save_init() in do_bounds() and task_get_bounds_dir() looks
> >>> wrong too, shouldn't it use unlazy_fpu() ? See the changelog in 3/3.
> >>
> >> IIRC, the 'cpu_has_xsaveopt' on the CPUs that support will MPX will
> >> enable eagerfpu.
> >
> > unless eagerfpu=off? but this doesn't matter.
>
> Yeah, that's true.  That would also explain why I haven't run in to this
> at all in testing.
>
> Ugh, fpu_save_init() says it isn't preempt safe anyway, so we shouldn't
> be using it.

Yes, plus (I _think_) _init can add more problems.

> I'll send a fix.

How about the trivial patch below (on top of this series) ?

Oleg.

--- x/arch/x86/kernel/traps.c
+++ x/arch/x86/kernel/traps.c
@@ -313,7 +313,7 @@ dotraplinkage void do_bounds(struct pt_r
 	 * It is not directly accessible, though, so we need to
 	 * do an xsave and then pull it out of the xsave buffer.
 	 */
-	fpu_save_init(&tsk->thread.fpu);
+	unlazy_fpu(tsk);
 	xsave_buf = &(tsk->thread.fpu.state->xsave);
 	bndcsr = get_xsave_addr(xsave_buf, XSTATE_BNDCSR);
 	if (!bndcsr)
--- x/arch/x86/mm/mpx.c
+++ x/arch/x86/mm/mpx.c
@@ -352,7 +352,7 @@ static __user void *task_get_bounds_dir(
 	 * The bounds directory pointer is stored in a register
 	 * only accessible if we first do an xsave.
 	 */
-	fpu_save_init(&tsk->thread.fpu);
+	unlazy_fpu(tsk);
 	bndcsr = get_xsave_addr(&tsk->thread.fpu.state->xsave, XSTATE_BNDCSR);
 	if (!bndcsr)
 		return MPX_INVALID_BOUNDS_DIR;

--
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