[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7lrtlgncz3qaycmyg2sk5hkhzexlfwo5snr43ixg3kmxrzh3ub@biackh7rexlo>
Date: Tue, 4 Nov 2025 09:23:52 +0000
From: Kiryl Shutsemau <kas@...nel.org>
To: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: linux-kernel@...r.kernel.org, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>, 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,
Xiaoyao Li <xiaoyao.li@...el.com>
Subject: Re: [v2][PATCH 1/2] x86/virt/tdx: Remove __user annotation from
kernel pointer
On Mon, Nov 03, 2025 at 03:44:37PM -0800, 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>
> 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
Acked-by: Kiryl Shutsemau <kas@...nel.org>
--
Kiryl Shutsemau / Kirill A. Shutemov
Powered by blists - more mailing lists