lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Thu, 1 Oct 2020 21:11:39 -0400 From: Peter Xu <peterx@...hat.com> To: Alexander Graf <graf@...zon.com> Cc: kvm list <kvm@...r.kernel.org>, Aaron Lewis <aaronlewis@...gle.com>, Sean Christopherson <sean.j.christopherson@...el.com>, Paolo Bonzini <pbonzini@...hat.com>, Jonathan Corbet <corbet@....net>, Vitaly Kuznetsov <vkuznets@...hat.com>, Wanpeng Li <wanpengli@...cent.com>, Jim Mattson <jmattson@...gle.com>, Joerg Roedel <joro@...tes.org>, KarimAllah Raslan <karahmed@...zon.de>, Dan Carpenter <dan.carpenter@...cle.com>, Maxim Levitsky <mlevitsk@...hat.com>, linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org Subject: Re: [PATCH v8 6/8] KVM: x86: VMX: Prevent MSR passthrough when MSR access is denied Hi, I reported in the v13 cover letter of kvm dirty ring series that this patch seems to have been broken. Today I tried to reproduce with a simplest vm, and after a closer look... On Fri, Sep 25, 2020 at 04:34:20PM +0200, Alexander Graf wrote: > @@ -3764,15 +3859,14 @@ static u8 vmx_msr_bitmap_mode(struct kvm_vcpu *vcpu) > return mode; > } > > -static void vmx_update_msr_bitmap_x2apic(struct kvm_vcpu *vcpu, > - unsigned long *msr_bitmap, u8 mode) > +static void vmx_update_msr_bitmap_x2apic(struct kvm_vcpu *vcpu, u8 mode) > { > int msr; > > - for (msr = 0x800; msr <= 0x8ff; msr += BITS_PER_LONG) { > - unsigned word = msr / BITS_PER_LONG; > - msr_bitmap[word] = (mode & MSR_BITMAP_MODE_X2APIC_APICV) ? 0 : ~0; > - msr_bitmap[word + (0x800 / sizeof(long))] = ~0; > + for (msr = 0x800; msr <= 0x8ff; msr++) { > + bool intercepted = !!(mode & MSR_BITMAP_MODE_X2APIC_APICV); > + > + vmx_set_intercept_for_msr(vcpu, msr, MSR_TYPE_RW, intercepted); > } > > if (mode & MSR_BITMAP_MODE_X2APIC) { ... I think we may want below change to be squashed: diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index d160aad59697..7d3f2815b04d 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -3781,9 +3781,10 @@ static void vmx_update_msr_bitmap_x2apic(struct kvm_vcpu *vcpu, u8 mode) int msr; for (msr = 0x800; msr <= 0x8ff; msr++) { - bool intercepted = !!(mode & MSR_BITMAP_MODE_X2APIC_APICV); + bool apicv = mode & MSR_BITMAP_MODE_X2APIC_APICV; - vmx_set_intercept_for_msr(vcpu, msr, MSR_TYPE_RW, intercepted); + vmx_set_intercept_for_msr(vcpu, msr, MSR_TYPE_R, !apicv); + vmx_set_intercept_for_msr(vcpu, msr, MSR_TYPE_W, true); } if (mode & MSR_BITMAP_MODE_X2APIC) { This fixes my problem the same as having this patch reverted. -- Peter Xu
Powered by blists - more mailing lists