public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Xiaoyao Li <xiaoyao.li@intel.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>,
	linux-kernel@vger.kernel.org,  Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
	 "Kirill A. Shutemov" <kas@kernel.org>,
	kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
	 Rick Edgecombe <rick.p.edgecombe@intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	x86@kernel.org
Subject: Re: [v2][PATCH 1/2] x86/virt/tdx: Remove __user annotation from kernel pointer
Date: Tue, 4 Nov 2025 08:31:02 -0800	[thread overview]
Message-ID: <aQoqRqb-vN5GxT-x@google.com> (raw)
In-Reply-To: <72503421-803c-4fa8-8e28-b0c793798c7c@intel.com>

On Tue, Nov 04, 2025, Xiaoyao Li wrote:
> On 11/4/2025 7:44 AM, Dave Hansen wrote:
> > 
> > From: Dave Hansen <dave.hansen@linux.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@linux.intel.com>
> > Fixes: 488808e682e7 ("KVM: x86: Introduce KVM_TDX_GET_CPUID")
> > Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.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.

Ya, I'll fixup when applying.

  reply	other threads:[~2025-11-04 16:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-03 23:44 [v2][PATCH 0/2] x86/virt/tdx: Minor sparse fixups Dave Hansen
2025-11-03 23:44 ` [v2][PATCH 1/2] x86/virt/tdx: Remove __user annotation from kernel pointer Dave Hansen
2025-11-04  9:23   ` Kiryl Shutsemau
2025-11-04  9:55   ` Xiaoyao Li
2025-11-04 16:31     ` Sean Christopherson [this message]
2025-11-03 23:44 ` [v2][PATCH 2/2] x86/virt/tdx: Fix sparse warnings from using 0 for NULL Dave Hansen
2025-11-04  9:24   ` Kiryl Shutsemau
2025-11-04  9:56   ` Xiaoyao Li
2025-11-18 23:27 ` [v2][PATCH 0/2] x86/virt/tdx: Minor sparse fixups Sean Christopherson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aQoqRqb-vN5GxT-x@google.com \
    --to=seanjc@google.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kas@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xiaoyao.li@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox