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: <20090601181208.GA30565@liondog.tnic>
Date:	Mon, 1 Jun 2009 20:12:08 +0200
From:	Borislav Petkov <petkovbb@...glemail.com>
To:	"H. Peter Anvin" <hpa@...or.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Borislav Petkov <borislav.petkov@....com>, greg@...ah.com,
	mingo@...e.hu, norsk5@...oo.com, tglx@...utronix.de,
	mchehab@...hat.com, aris@...hat.com, edt@....ca,
	linux-kernel@...r.kernel.org, randy.dunlap@...cle.com,
	Sam Ravnborg <sam@...nborg.org>
Subject: Re: [PATCH 0/4] amd64_edac: misc fixes

On Mon, Jun 01, 2009 at 09:54:41AM -0700, H. Peter Anvin wrote:
> Borislav Petkov wrote:
> > 
> > How about we pin the src/dst into a register:
> > 
> > #define popcnt_spelled(x)                                       \
> > ({                                                              \
> >         typeof(x) __ret;                                        \
> >         __asm__(".byte 0xf3\n\t.byte 0x48\n\t.byte 0x0f\n\t"    \
> >                 ".byte 0xb8\n\t.byte 0xc0\n\t"                  \
> >                 : "=a" (__ret)                                  \
> >                 : "0" (x));                                     \
> >         __ret;                                                  \
> > })
> > 
> > which generates
> > 
> >   40055e:       48 8b 45 e8             mov    -0x18(%rbp),%rax
> >   400562:       f3 48 0f b8 c0          popcnt %rax,%rax
> >   400567:       48 89 45 f8             mov    %rax,-0x8(%rbp)
> > 
> > here.
> > 
> 
> Yes, we would have to do something like that.
> 
> However, if you're doing that you shouldn't use typeof() there...
> instead this should be turned into an inline function with explicit
> 64-bit types.

right.

> It would be good if we could get Kbuild to export some kind of macro
> that we can use to test binutils version, so we can do something like:
> 
> #if BINUTILS_VERSION >= KERNEL_VERSION(2,18,50)
> /* Do the right thing */
> #else
> /* Do the wrong thing */
> #endif

Actually, popcnt got added to gas in July 2006 so checking the gas
version should suffice, IMHO.

Anyway, I proposed something similar before but Andrew suggested that we
should simply slap in the opcode so we don't need the Kbuild changes.
The advantage of the approach is that it works unconditionally on all
toolchains and introduces less code changes. Hmm...

-- 
Regards/Gruss,
    Boris.
--
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