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: <72503421-803c-4fa8-8e28-b0c793798c7c@intel.com>
Date: Tue, 4 Nov 2025 17:55:40 +0800
From: Xiaoyao Li <xiaoyao.li@...el.com>
To: Dave Hansen <dave.hansen@...ux.intel.com>, linux-kernel@...r.kernel.org
Cc: Borislav Petkov <bp@...en8.de>, "H. Peter Anvin" <hpa@...or.com>,
 Ingo Molnar <mingo@...hat.com>, "Kirill A. Shutemov" <kas@...nel.org>,
 kvm@...r.kernel.org, Paolo Bonzini <pbonzini@...hat.com>,
 Rick Edgecombe <rick.p.edgecombe@...el.com>,
 Sean Christopherson <seanjc@...gle.com>, Thomas Gleixner
 <tglx@...utronix.de>, x86@...nel.org
Subject: Re: [v2][PATCH 1/2] x86/virt/tdx: Remove __user annotation from
 kernel pointer

On 11/4/2025 7:44 AM, Dave Hansen wrote:
> 
> From: Dave Hansen <dave.hansen@...ux.intel.com>
> 
> Separate __user pointer variable declaration from kernel one.
> 
> There are two 'kvm_cpuid2' pointers involved here. There's an "input"
> side: 'td_cpuid' which is a normal kernel pointer and an 'output'
> side. The output here is userspace and there is an attempt at properly
> annotating the variable with __user:
> 
> 	struct kvm_cpuid2 __user *output, *td_cpuid;
> 
> But, alas, this is wrong. The __user in the definition applies to both
> 'output' and 'td_cpuid'. Sparse notices the address space mismatch and
> will complain about it.
> 
> Fix it up by completely separating the two definitions so that it is
> obviously correct without even having to know what the C syntax rules
> even are.
> 
> Signed-off-by: Dave Hansen <dave.hansen@...ux.intel.com>
> Fixes: 488808e682e7 ("KVM: x86: Introduce KVM_TDX_GET_CPUID")
> Reviewed-by: Rick Edgecombe <rick.p.edgecombe@...el.com>

the prefix of the shortlog is still "x86/virt/tdx". I think Sean will 
change it to "KVM: TDX:", if it gets routed through KVM tree.

Anyway,

Reviewed-by: Xiaoyao Li <xiaoyao.li@...el.com>

> Cc: Xiaoyao Li <xiaoyao.li@...el.com>
> Cc: Sean Christopherson <seanjc@...gle.com>
> Cc: Paolo Bonzini <pbonzini@...hat.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: Borislav Petkov <bp@...en8.de>
> Cc: x86@...nel.org
> Cc: "H. Peter Anvin" <hpa@...or.com>
> Cc: "Kirill A. Shutemov" <kas@...nel.org>
> Cc: Rick Edgecombe <rick.p.edgecombe@...el.com>
> Cc: kvm@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org
> ---
> 
>   b/arch/x86/kvm/vmx/tdx.c |    3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff -puN arch/x86/kvm/vmx/tdx.c~tdx-sparse-fix-3 arch/x86/kvm/vmx/tdx.c
> --- a/arch/x86/kvm/vmx/tdx.c~tdx-sparse-fix-3	2025-11-03 15:11:26.773525519 -0800
> +++ b/arch/x86/kvm/vmx/tdx.c	2025-11-03 15:11:26.782526277 -0800
> @@ -3054,7 +3054,8 @@ static int tdx_vcpu_get_cpuid_leaf(struc
>   
>   static int tdx_vcpu_get_cpuid(struct kvm_vcpu *vcpu, struct kvm_tdx_cmd *cmd)
>   {
> -	struct kvm_cpuid2 __user *output, *td_cpuid;
> +	struct kvm_cpuid2 __user *output;
> +	struct kvm_cpuid2 *td_cpuid;
>   	int r = 0, i = 0, leaf;
>   	u32 level;
>   
> _


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ