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: <20150317100046.GA19131@chrystal.uk.oracle.com>
Date:	Tue, 17 Mar 2015 11:00:46 +0100
From:	Quentin Casasnovas <quentin.casasnovas@...cle.com>
To:	Borislav Petkov <bp@...e.de>
Cc:	Quentin Casasnovas <quentin.casasnovas@...cle.com>,
	Oleg Nesterov <oleg@...hat.com>,
	Dave Hansen <dave.hansen@...el.com>,
	Ingo Molnar <mingo@...nel.org>,
	Andy Lutomirski <luto@...capital.net>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Pekka Riikonen <priikone@....fi>,
	Rik van Riel <riel@...hat.com>,
	Suresh Siddha <sbsiddha@...il.com>,
	LKML <linux-kernel@...r.kernel.org>,
	"Yu, Fenghua" <fenghua.yu@...el.com>,
	"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH RFC 0/2] x86/fpu: avoid "xstate_fault" in
 xsave_user/xrestore_user

On Tue, Mar 17, 2015 at 10:47:50AM +0100, Borislav Petkov wrote:
> On Mon, Mar 16, 2015 at 11:37:44PM +0100, Quentin Casasnovas wrote:
> 
> ...
> 
> >   __user_insn("btl [var2], %0		\n\t",
> >   	      , /* no outputs, no need for dummy arg */
> > 	      SINGLE_ARG("r" (var1), [var2] "r" (var2)), /* two inputs */
> > 	      "cc");
> 
> So this becomes pretty unreadable IMO. And we shouldn't go nuts with
> optimizing this and sacrifice readability a lot.
> 
> TBH, I'd much prefer:
> 
> 	if (static_cpu_has_safe(X86_FEATURE_XSAVEOPT)) {
> 		check_insn(XSAVEOPT, ...);
                                     ^
> 		return;
> 	}
> 
> 	if (static_cpu_has_safe(X86_FEATURE_XSAVES)) {
> 		check_insn(XSAVES);
> 		return;
> 	}
> 
> 	check_insn(XSAVE, ...)
> 
> which is pretty clear.
>

Fair point, but AFAIUI we can't do check_insn(XSAVES) alone as of today,
and the "..." in your "check_isns(XSAVEOPT, ...)" code above would still
need to contain the outputs operands.

My suggestion was to rework (check|user)_insn() so it can accept zero to N
inputs, outputs or clobbers to make it generic enough so the snippet of
code you've written becomes valid, and maybe move those macro where they
can be used for other sub-systems?

Am I missing something?

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