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: <20250511093012.GBaCBuJDhtPXqCcwQv@fat_crate.local>
Date: Sun, 11 May 2025 11:30:12 +0200
From: Borislav Petkov <bp@...en8.de>
To: Seongmanlee <cloudlee1719@...il.com>
Cc: x86@...nel.org, leonardo-leecaprio <augustus92@...st.ac.kr>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] x86/sev: Fix operator precedence in
 GHCB_MSR_VMPL_REQ_LEVEL macro

On Sun, May 11, 2025 at 06:23:28PM +0900, Seongmanlee wrote:
> From: leonardo-leecaprio <augustus92@...st.ac.kr>
	^^^^^^^^^^^^^

Right, when you fix the name, you need to fix the authorship too:

$ git commit --amend --author="Seongman Lee <augustus92@...st.ac.kr>"

as this name will appear in the git history.

But no worries, I'll fix it up when applying - just something to think about
in the future.

You can also set your name in .git/config or .gitconfig and then it'll be
correct automagically.

> The GHCB_MSR_VMPL_REQ_LEVEL macro lacked parentheses around the bitmask
> expression, causing the shift operation to bind too early. As a result,
> when switching to VMPL2 from VMPL1 (e.g., GHCB_MSR_VMPL_REQ_LEVEL(1)),
> incorrect values such as 0x000000016 were generated instead of the intended
> 0x100000016.
> 
> Fixes the precedence issue by grouping the masked value before applying
> the shift.
> 
> Fixes: 34ff65901735 ("x86/sev: Use kernel provided SVSM Calling Areas")
> 
> Signed-off-by: Seongman Lee <augustus92@...st.ac.kr>
> ---
>  arch/x86/include/asm/sev-common.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/include/asm/sev-common.h b/arch/x86/include/asm/sev-common.h
> index acb85b934..0020d77a0 100644
> --- a/arch/x86/include/asm/sev-common.h
> +++ b/arch/x86/include/asm/sev-common.h
> @@ -116,7 +116,7 @@ enum psc_op {
>  #define GHCB_MSR_VMPL_REQ		0x016
>  #define GHCB_MSR_VMPL_REQ_LEVEL(v)			\
>  	/* GHCBData[39:32] */				\
> -	(((u64)(v) & GENMASK_ULL(7, 0) << 32) |		\
> +	((((u64)(v) & GENMASK_ULL(7, 0)) << 32) |	\
>  	/* GHCBDdata[11:0] */				\
>  	GHCB_MSR_VMPL_REQ)
>  
> -- 

Thx.

-- 
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