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: <20250317101415.GBZ9f198PAh90nMWDf@fat_crate.local>
Date: Mon, 17 Mar 2025 11:14:15 +0100
From: Borislav Petkov <bp@...en8.de>
To: linux-kernel@...r.kernel.org
Cc: linux-tip-commits@...r.kernel.org, Uros Bizjak <ubizjak@...il.com>,
	Ingo Molnar <mingo@...nel.org>, Andy Lutomirski <luto@...nel.org>,
	Brian Gerst <brgerst@...il.com>, "H. Peter Anvin" <hpa@...or.com>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>, x86@...nel.org
Subject: Re: [tip: x86/fpu] x86/fpu: Use XSAVE{,OPT,C,S} and XRSTOR{,S}
 mnemonics in xstate.h

On Thu, Mar 13, 2025 at 05:50:34PM -0000, tip-bot2 for Uros Bizjak wrote:
> The following commit has been merged into the x86/fpu branch of tip:
> 
> Commit-ID:     2883b4c2169a435488f7845e1b6fdc6f3438c7c6
> Gitweb:        https://git.kernel.org/tip/2883b4c2169a435488f7845e1b6fdc6f3438c7c6
> Author:        Uros Bizjak <ubizjak@...il.com>
> AuthorDate:    Thu, 13 Mar 2025 14:02:27 +01:00
> Committer:     Ingo Molnar <mingo@...nel.org>
> CommitterDate: Thu, 13 Mar 2025 18:36:52 +01:00
> 
> x86/fpu: Use XSAVE{,OPT,C,S} and XRSTOR{,S} mnemonics in xstate.h
> 
> Current minimum required version of binutils is 2.25, which
> supports XSAVE{,OPT,C,S} and XRSTOR{,S} instruction mnemonics.
> 
> Replace the byte-wise specification of XSAVE{,OPT,C,S}
> and XRSTOR{,S} with these proper mnemonics.
> 
> No functional change intended.
> 
> Signed-off-by: Uros Bizjak <ubizjak@...il.com>
> Signed-off-by: Ingo Molnar <mingo@...nel.org>
> Cc: Andy Lutomirski <luto@...nel.org>
> Cc: Brian Gerst <brgerst@...il.com>
> Cc: H. Peter Anvin <hpa@...or.com>
> Cc: Dave Hansen <dave.hansen@...ux.intel.com>
> Cc: Linus Torvalds <torvalds@...ux-foundation.org>
> Link: https://lore.kernel.org/r/20250313130251.383204-1-ubizjak@gmail.com
> ---
>  arch/x86/kernel/fpu/xstate.h | 27 +++++++++++++--------------
>  1 file changed, 13 insertions(+), 14 deletions(-)
> 
> diff --git a/arch/x86/kernel/fpu/xstate.h b/arch/x86/kernel/fpu/xstate.h
> index aa16f1a..1418423 100644
> --- a/arch/x86/kernel/fpu/xstate.h
> +++ b/arch/x86/kernel/fpu/xstate.h
> @@ -94,18 +94,17 @@ static inline int update_pkru_in_sigframe(struct xregs_state __user *buf, u64 ma
>  /* XSAVE/XRSTOR wrapper functions */
>  
>  #ifdef CONFIG_X86_64
> -#define REX_PREFIX	"0x48, "
> +#define REX_SUFFIX	"64"
>  #else
> -#define REX_PREFIX
> +#define REX_SUFFIX
>  #endif
>  
> -/* These macros all use (%edi)/(%rdi) as the single memory argument. */
> -#define XSAVE		".byte " REX_PREFIX "0x0f,0xae,0x27"
> -#define XSAVEOPT	".byte " REX_PREFIX "0x0f,0xae,0x37"
> -#define XSAVEC		".byte " REX_PREFIX "0x0f,0xc7,0x27"
> -#define XSAVES		".byte " REX_PREFIX "0x0f,0xc7,0x2f"
> -#define XRSTOR		".byte " REX_PREFIX "0x0f,0xae,0x2f"
> -#define XRSTORS		".byte " REX_PREFIX "0x0f,0xc7,0x1f"
> +#define XSAVE		"xsave" REX_SUFFIX " %[xa]"
> +#define XSAVEOPT	"xsaveopt" REX_SUFFIX " %[xa]"
> +#define XSAVEC		"xsavec" REX_SUFFIX " %[xa]"
> +#define XSAVES		"xsaves" REX_SUFFIX " %[xa]"
> +#define XRSTOR		"xrstor" REX_SUFFIX " %[xa]"
> +#define XRSTORS		"xrstors" REX_SUFFIX " %[xa]"
>  
>  /*
>   * After this @err contains 0 on success or the trap number when the
> @@ -114,10 +113,10 @@ static inline int update_pkru_in_sigframe(struct xregs_state __user *buf, u64 ma
>  #define XSTATE_OP(op, st, lmask, hmask, err)				\
>  	asm volatile("1:" op "\n\t"					\
>  		     "xor %[err], %[err]\n"				\
> -		     "2:\n\t"						\
> +		     "2:\n"						\
>  		     _ASM_EXTABLE_TYPE(1b, 2b, EX_TYPE_FAULT_MCE_SAFE)	\
>  		     : [err] "=a" (err)					\
> -		     : "D" (st), "m" (*st), "a" (lmask), "d" (hmask)	\
> +		     : [xa] "m" (*(st)), "a" (lmask), "d" (hmask)	\

This [xa] needs documenting in the comment above this.

What does "xa" even mean?

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ