Re: [PATCH 1/2] x86/virt/tdx: Remove __user annotation from kernel pointer
From: Edgecombe, Rick P
Date: Wed Oct 29 2025 - 17:06:50 EST
For the KVM side of tdx, the commits are getting prefixed with "KVM: TDX: ", and
"x86/virt/tdx" is being used arch/x86/virt/vmx/tdx/tdx.c. It's probably not too
late to adopt the one true naming scheme. I don't have a strong preference
except some consistency and that the maintainers agree :)
On Wed, 2025-10-29 at 12:48 -0700, Dave Hansen wrote:
> From: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
Pretty much the only difference between tip style logs and kvm/x86 style logs is
to lead with a short "what is the change" blurb before launching into the
background. Like:
KVM: TDX: Remove __user annotation from kernel pointer
Fix sparse warning in tdx_vcpu_get_cpuid().
There are two 'kvm_cpuid2' pointers involved here...
>
> 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'.
>
> 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.
If we want it:
Fixes: 488808e682e7 ("KVM: x86: Introduce KVM_TDX_GET_CPUID")
TIL on the syntax association here.