All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Joe Perches <joe@perches.com>, Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>,
	Igor Mammedov <imammedo@redhat.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH 2/2] KVM: x86: Use memcmp in kvm_cpuid_check_equal()
Date: Wed, 26 Jan 2022 16:02:38 +0000	[thread overview]
Message-ID: <YfFwnm3Vp0eOPElp@google.com> (raw)
In-Reply-To: <878rv2izjp.fsf@redhat.com>

On Wed, Jan 26, 2022, Vitaly Kuznetsov wrote:
> Joe Perches <joe@perches.com> writes:
> 
> > On Mon, 2022-01-24 at 11:36 +0100, Vitaly Kuznetsov wrote:
> >> kvm_cpuid_check_equal() should also check .flags equality but instead
> >> of adding it to the existing check, just switch to using memcmp() for
> >> the whole 'struct kvm_cpuid_entry2'.
> >
> > Is the struct padding guaranteed to be identical ?
> >
> 
> Well, yes (or we're all doomeed):
> - 'struct kvm_cpuid_entry2' is part of KVM userspace ABI, it is supposed
> to be stable.
> - Here we compare structs which come from the same userspace during one
> session (vCPU fd stays open), I can't imagine how structure layout can
> change on-the-fly.

I'm pretty sure Joe was asking if the contents of the padding field would be
identical, i.e. if KVM can guarnatee there won't be false positives on mismatches,
which is the same reason Paolo passed on this patch.  Though I still think we
should roll the dice :-)

  reply	other threads:[~2022-01-26 16:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-24 10:36 [PATCH 0/2] KVM: x86: Partially allow KVM_SET_CPUID{,2} follow-up Vitaly Kuznetsov
2022-01-24 10:36 ` [PATCH 1/2] KVM: x86: Move CPUID.(EAX=0x12,ECX=1) mangling to __kvm_update_cpuid_runtime() Vitaly Kuznetsov
2022-01-24 10:36 ` [PATCH 2/2] KVM: x86: Use memcmp in kvm_cpuid_check_equal() Vitaly Kuznetsov
2022-01-24 14:02   ` Paolo Bonzini
2022-01-24 15:10     ` Vitaly Kuznetsov
2022-01-24 16:52       ` Sean Christopherson
2022-01-24 17:07         ` Paolo Bonzini
2022-01-24 19:08           ` Sean Christopherson
2022-01-24 21:03   ` Joe Perches
2022-01-26 10:03     ` Vitaly Kuznetsov
2022-01-26 16:02       ` Sean Christopherson [this message]
2022-01-26 16:25         ` Vitaly Kuznetsov

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=YfFwnm3Vp0eOPElp@google.com \
    --to=seanjc@google.com \
    --cc=imammedo@redhat.com \
    --cc=jmattson@google.com \
    --cc=joe@perches.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.