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:	Mon, 8 Aug 2016 11:45:58 -0700
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Borislav Petkov <bp@...en8.de>
Cc:	Ville Syrjälä <ville.syrjala@...ux.intel.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	"the arch/x86 maintainers" <x86@...nel.org>,
	Borislav Petkov <bp@...e.de>,
	"H . Peter Anvin" <hpa@...or.com>,
	Andy Lutomirski <luto@...capital.net>,
	Brian Gerst <brgerst@...il.com>,
	Denys Vlasenko <dvlasenk@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...nel.org>, Jiri Kosina <jkosina@...e.cz>
Subject: Re: [PATCH] x86/hweight: Don't clobber %rdi

On Mon, Aug 8, 2016 at 11:37 AM, Borislav Petkov <bp@...en8.de> wrote:
>
> Ok, so do you think it would work too if I stated that the input
> register gets clobbered:
>
>         asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT)
>                          : "="REG_OUT (res)
>                          : REG_IN (w)
>                          : REG_IN);

That would work (although the clobbered registers have a different
syntax than the in/out registers), but it would be wrong, in my
opinion.

We want the actual POPCNT instruction to be the common case, and that
instruction does *not* clobber any other registers than the output.

So I think it's much better to just say: "the __sw_hweight functions
should have the same semantics as popcnt" (although without the eflags
rules that we don't care about).

There's nothing wrong with keeping it as assembly language - it's not
like it's a maintenance headache once it is written.

               Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ