[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220629102401.GC882746@ls.amr.corp.intel.com>
Date: Wed, 29 Jun 2022 03:24:01 -0700
From: Isaku Yamahata <isaku.yamahata@...il.com>
To: Sagi Shahar <sagis@...gle.com>
Cc: "Yamahata, Isaku" <isaku.yamahata@...el.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, isaku.yamahata@...il.com,
Paolo Bonzini <pbonzini@...hat.com>,
Erdem Aktas <erdemaktas@...gle.com>,
Sean Christopherson <seanjc@...gle.com>
Subject: Re: [RFC PATCH v6 095/104] KVM: TDX: Handle TDX PV rdmsr/wrmsr
hypercall
On Fri, Jun 10, 2022 at 02:04:49PM -0700,
Sagi Shahar <sagis@...gle.com> wrote:
> On Thu, May 5, 2022 at 11:16 AM <isaku.yamahata@...el.com> wrote:
> >
> > From: Isaku Yamahata <isaku.yamahata@...el.com>
> >
> > Wire up TDX PV rdmsr/wrmsr hypercall to the KVM backend function.
> >
> > Signed-off-by: Isaku Yamahata <isaku.yamahata@...el.com>
> > Reviewed-by: Paolo Bonzini <pbonzini@...hat.com>
> > ---
> > arch/x86/kvm/vmx/tdx.c | 37 +++++++++++++++++++++++++++++++++++++
> > 1 file changed, 37 insertions(+)
> >
> > diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> > index f46825843a8b..1518a8c310d6 100644
> > --- a/arch/x86/kvm/vmx/tdx.c
> > +++ b/arch/x86/kvm/vmx/tdx.c
> > @@ -1169,6 +1169,39 @@ static int tdx_emulate_mmio(struct kvm_vcpu *vcpu)
> > return 1;
> > }
> >
> > +static int tdx_emulate_rdmsr(struct kvm_vcpu *vcpu)
> > +{
> > + u32 index = tdvmcall_a0_read(vcpu);
> > + u64 data;
> > +
> > + if (kvm_get_msr(vcpu, index, &data)) {
>
> kvm_get_msr and kvm_set_msr used to check the MSR permissions using
> kvm_msr_allowed but that behaviour changed in "KVM: x86: Only do MSR
> filtering when access MSR by rdmsr/wrmsr".
>
> Now kvm_get_msr and kvm_set_msr skip these checks and will allow
> access regardless of the permissions in the msr_filter.
>
> These should be changed to kvm_get_msr_with_filter and
> kvm_set_msr_with_filter or something similar that checks permissions
> for MSR access.
Thanks for pointing it out. I fixed it as adding kvm_msr_allowed()
--
Isaku Yamahata <isaku.yamahata@...il.com>
Powered by blists - more mailing lists