[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aEB0JZJNs3dDZWJx@google.com>
Date: Wed, 4 Jun 2025 09:28:21 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Borislav Petkov <bp@...en8.de>, Xin Li <xin@...or.com>, Chao Gao <chao.gao@...el.com>,
Dapeng Mi <dapeng1.mi@...ux.intel.com>
Subject: Re: [PATCH 25/28] KVM: nSVM: Access MSRPM in 4-byte chunks only for
merging L0 and L1 bitmaps
On Wed, Jun 04, 2025, Paolo Bonzini wrote:
> On 5/30/25 01:40, Sean Christopherson wrote:
> > @@ -1363,8 +1357,9 @@ void svm_leave_nested(struct kvm_vcpu *vcpu)
> > static int nested_svm_exit_handled_msr(struct vcpu_svm *svm)
> > {
> > - u32 offset, msr, value;
> > - int write, mask;
> > + u32 offset, msr;
> > + int write;
> > + u8 value;
> > if (!(vmcb12_is_intercept(&svm->nested.ctl, INTERCEPT_MSR_PROT)))
> > return NESTED_EXIT_HOST;
> > @@ -1372,18 +1367,15 @@ static int nested_svm_exit_handled_msr(struct vcpu_svm *svm)
> > msr = svm->vcpu.arch.regs[VCPU_REGS_RCX];
> > offset = svm_msrpm_offset(msr);
> > write = svm->vmcb->control.exit_info_1 & 1;
> > - mask = 1 << ((2 * (msr & 0xf)) + write);
>
> This is wrong. The bit to read isn't always bit 0 or bit 1, therefore mask
> needs to remain.
/facepalm
Duh. I managed to forget that multiple MSRs are packed into a byte. Hrm, which
means our nSVM test is even more worthless than I thought. I'll see if I can get
it to detect this bug.
Powered by blists - more mailing lists