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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Sat, 25 Apr 2015 10:24:13 +0200
From:	Borislav Petkov <bp@...en8.de>
To:	Dave Hansen <dave@...1.net>
Cc:	linux-kernel@...r.kernel.org, dave.hansen@...ux.intel.com,
	x86@...nel.org, fenghua.yu@...el.com, oleg@...hat.com,
	luto@...capital.net
Subject: Re: [PATCH] x86, fpu: rename XCR0 access macro

On Fri, Apr 24, 2015 at 04:00:35PM -0700, Dave Hansen wrote:
> 
> From: Dave Hansen <dave.hansen@...ux.intel.com>
> 
> The SDM says that the xgetbv instruction:
> 
> 	Reads the contents of the extended control register (XCR)
> 	specified in the ECX register into registers EDX:EAX.
> 
> In other words, xgetbv(0) gets the thing that the SDM calls XCR0.
> We have a macro for that "0" and we call it
> XCR_XFEATURE_ENABLED_MASK.  That's a bit unfortunate because it
> is not a mask nor does the "0" have much to do with the features
> we have enabled.  It's an index if anything.
> 
> Rename the macro to what it means: "XCR0".
> 
> Signed-off-by: Dave Hansen <dave.hansen@...ux.intel.com>
> Cc: x86@...nel.org
> Cc: Fenghua Yu <fenghua.yu@...el.com>
> Cc: Borislav Petkov <bp@...en8.de>
> Cc: Oleg Nesterov <oleg@...hat.com>
> Cc: Andy Lutomirski <luto@...capital.net>
> 
> ---
> 
>  b/arch/x86/crypto/camellia_aesni_avx2_glue.c |    2 +-
>  b/arch/x86/crypto/camellia_aesni_avx_glue.c  |    2 +-
>  b/arch/x86/crypto/cast5_avx_glue.c           |    2 +-
>  b/arch/x86/crypto/cast6_avx_glue.c           |    2 +-
>  b/arch/x86/crypto/serpent_avx2_glue.c        |    2 +-
>  b/arch/x86/crypto/serpent_avx_glue.c         |    2 +-
>  b/arch/x86/crypto/sha1_ssse3_glue.c          |    2 +-
>  b/arch/x86/crypto/sha256_ssse3_glue.c        |    2 +-
>  b/arch/x86/crypto/sha512_ssse3_glue.c        |    2 +-
>  b/arch/x86/crypto/twofish_avx_glue.c         |    2 +-
>  b/arch/x86/include/asm/xcr.h                 |    6 +++++-
>  b/arch/x86/kernel/xsave.c                    |    2 +-
>  b/arch/x86/kvm/x86.c                         |   16 ++++++++--------
>  b/arch/x86/power/cpu.c                       |    2 +-
>  14 files changed, 25 insertions(+), 21 deletions(-)

Applied, but...

> diff -puN arch/x86/include/asm/xcr.h~x86-fpu-rename-xcr0-macro arch/x86/include/asm/xcr.h
> --- a/arch/x86/include/asm/xcr.h~x86-fpu-rename-xcr0-macro	2015-04-24 15:55:10.456089437 -0700
> +++ b/arch/x86/include/asm/xcr.h	2015-04-24 15:55:10.483090655 -0700
> @@ -17,13 +17,17 @@
>  #ifndef _ASM_X86_XCR_H
>  #define _ASM_X86_XCR_H
>  
> -#define XCR_XFEATURE_ENABLED_MASK	0x00000000
> +#define XCR0	0x00000000

... changed that to a simple "0".

Btw, I can imagine this becoming a macro, i.e. XCR(num) later. I see
there already is the %ecx==1 call option of XGETBV which gives you the
optimization used by XSAVEOPT/XSAVES so it is all a matter of time. :)

Thanks.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
--
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