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:	Tue, 10 May 2016 19:23:13 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Borislav Petkov <bp@...e.de>
Cc:	x86-ml <x86@...nel.org>, Denys Vlasenko <dvlasenk@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, Brian Gerst <brgerst@...il.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Dmitry Vyukov <dvyukov@...gle.com>,
	Andi Kleen <andi@...stfloor.org>, zengzhaoxiu@....com,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Kees Cook <keescook@...omium.org>,
	Zhaoxiu Zeng <zhaoxiu.zeng@...il.com>,
	Andy Lutomirski <luto@...capital.net>
Subject: Re: [PATCH -v2] x86/hweight: Get rid of the special calling
 convention

On Tue, May 10, 2016 at 06:53:18PM +0200, Borislav Petkov wrote:
>  static __always_inline unsigned int __arch_hweight32(unsigned int w)
>  {
> -	unsigned int res = 0;
> +	unsigned int res;
>  
> -	asm (ALTERNATIVE("call __sw_hweight32", POPCNT32, X86_FEATURE_POPCNT)
> -		     : "="REG_OUT (res)
> -		     : REG_IN (w));
> +	if (likely(static_cpu_has(X86_FEATURE_POPCNT))) {
> +		/* popcnt %eax, %eax */
> +		asm volatile(POPCNT32
> +				: "="REG_OUT (res)
> +				: REG_IN (w));
>  
> -	return res;
> +		return res;
> +	}
> +	return __sw_hweight32(w);
>  }

So what was wrong with using the normal thunk_*.S wrappers for the
calls? That would allow you to use the alternative() stuff which does
generate smaller code.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ