All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Roman Penyaev <roman.penyaev@profitbricks.com>,
	Mikhail Sennikovskii <mikhail.sennikovskii@profitbricks.com>,
	Gleb Natapov <gleb@kernel.org>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Andy Lutomirski <luto@amacapital.net>
Subject: Re: [RFC] KVM: SVM: do not drop VMCB CPL to 0 if SS is not present
Date: Tue, 30 May 2017 17:13:02 +0200	[thread overview]
Message-ID: <b4f1b0c0-0db7-e399-b28b-d7f0ceada2d8@redhat.com> (raw)
In-Reply-To: <CAJrWOzD6Xq==b-zYCDdFLgSRMPM-NkNuTSDFEtX=7MreT45i7Q@mail.gmail.com>



On 19/05/2017 18:14, Roman Penyaev wrote:
> 
> 1. Simple one, KVM SVM side, which makes sure that CPL is not updated
>    if segment is unusable:
> 
>    --- a/arch/x86/kvm/svm.c
>    +++ b/arch/x86/kvm/svm.c
>    @@ -1549,7 +1549,7 @@ static void svm_set_segment(struct kvm_vcpu *vcpu,
>             * forces SS.DPL to 3 on sysret, so we ignore that case; fixing it
>             * would entail passing the CPL to userspace and back.
>             */
>    -       if (seg == VCPU_SREG_SS)
>    +       if (seg == VCPU_SREG_SS && !var->unusable)
>                    svm->vmcb->save.cpl = (s->attrib >>
> SVM_SELECTOR_DPL_SHIFT) & 3;

Based on the discussion between you and Andy, my understanding is that
it would not be enough to ensure that the attributes are preserved
across a roundtrip through KVM_GET_SEGMENT and KVM_SET_SEGMENT.  We need
a workaround in the hypervisor if we don't want to pass the CPL to
userspace and back.

Maybe if 1) in 64-bit mode 2) SS.P=0 3) SS selector != 0, then the CPL
can be taken from SS.RPL?

Thanks,

Paolo

  parent reply	other threads:[~2017-05-30 15:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-19 16:14 [RFC] KVM: SVM: do not drop VMCB CPL to 0 if SS is not present Roman Penyaev
2017-05-21  3:31 ` Andy Lutomirski
2017-05-21  7:53   ` Roman Penyaev
2017-05-21 20:19     ` Andy Lutomirski
2017-05-24 19:19       ` Roman Penyaev
2017-05-30 14:47 ` Paolo Bonzini
2017-05-30 17:35   ` Roman Penyaev
2017-05-30 21:09     ` Paolo Bonzini
2017-05-31 10:17       ` Roman Penyaev
2017-05-31 10:50         ` Paolo Bonzini
2017-05-30 15:13 ` Paolo Bonzini [this message]
2017-05-30 15:58   ` Roman Penyaev
2017-05-30 16:05     ` Paolo Bonzini
2017-05-30 16:31       ` Gi-Oh Kim
2017-06-15 21:44       ` Andy Lutomirski
2017-06-16  8:44         ` Roman Penyaev
2017-06-16 16:40         ` Paolo Bonzini

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=b4f1b0c0-0db7-e399-b28b-d7f0ceada2d8@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=gleb@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mikhail.sennikovskii@profitbricks.com \
    --cc=roman.penyaev@profitbricks.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.