All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Like Xu <like.xu.linux@gmail.com>
Cc: "Tian, Kevin" <kevin.tian@intel.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	"Liu, Jing2" <jing2.liu@intel.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Joerg Roedel <joro@8bytes.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] KVM: x86/cpuid: Exclude unpermitted xfeatures for vcpu->arch.guest_supported_xcr0
Date: Mon, 24 Jan 2022 16:23:09 +0000	[thread overview]
Message-ID: <Ye7SbfPL/QAjOI6s@google.com> (raw)
In-Reply-To: <38c1fbc3-d770-48f3-5432-8fa1fde033f5@gmail.com>

On Mon, Jan 24, 2022, Like Xu wrote:
> On 24/1/2022 3:06 pm, Tian, Kevin wrote:
> > > From: Like Xu <like.xu.linux@gmail.com>
> > > Sent: Sunday, January 23, 2022 1:50 PM
> > > 
> > > From: Like Xu <likexu@tencent.com>
> > > 
> > > A malicious user space can bypass xstate_get_guest_group_perm() in the
> > > KVM_GET_SUPPORTED_CPUID mechanism and obtain unpermitted xfeatures,
> > > since the validity check of xcr0 depends only on guest_supported_xcr0.
> > 
> > Unpermitted xfeatures cannot pass kvm_check_cpuid()...
> 
> Indeed, 5ab2f45bba4894a0db4af8567da3efd6228dd010.
> 
> This part of logic is pretty fragile and fragmented due to semantic
> inconsistencies between supported_xcr0 and guest_supported_xcr0
> in other three places:

There are no inconsistencies, at least not in the examples below, as the examples
are intended to work in host context.  guest_supported_xcr0 is about what the guest
is/isn't allowed to access, it has no bearing on what host userspace can/can't do.
Or are you talking about a different type of inconsistency?

> - __do_cpuid_func

Reporting what KVM supports to host userspace.

> - kvm_mpx_supported

This is a check on host support.

> - kvm_vcpu_ioctl_x86_set_xsave

"write" from host userspace.

> Have you identified all their areas of use ?

  reply	other threads:[~2022-01-24 16:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-23  5:50 [PATCH] KVM: x86/cpuid: Exclude unpermitted xfeatures for vcpu->arch.guest_supported_xcr0 Like Xu
2022-01-24  7:06 ` Tian, Kevin
2022-01-24  7:17   ` Like Xu
2022-01-24 16:23     ` Sean Christopherson [this message]
2022-01-24 16:29       ` Paolo Bonzini
2022-01-25  1:54         ` Tian, Kevin
2022-01-25  8:27           ` Paolo Bonzini
2022-01-26  1:23             ` Tian, Kevin

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=Ye7SbfPL/QAjOI6s@google.com \
    --to=seanjc@google.com \
    --cc=jing2.liu@intel.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=like.xu.linux@gmail.com \
    --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.