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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <7AEDDBE7-138A-455F-957C-C2DE64BD8B06@oracle.com>
Date:   Wed, 4 Sep 2019 02:20:08 +0300
From:   Liran Alon <liran.alon@...cle.com>
To:     Alexander Graf <graf@...zon.com>
Cc:     kvm list <kvm@...r.kernel.org>, linux-kernel@...r.kernel.org,
        x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
        Borislav Petkov <bp@...en8.de>, Ingo Molnar <mingo@...hat.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Joerg Roedel <joro@...tes.org>,
        Jim Mattson <jmattson@...gle.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        Sean Christopherson <sean.j.christopherson@...el.com>,
        Radim Krčmář <rkrcmar@...hat.com>,
        Paolo Bonzini <pbonzini@...hat.com>
Subject: Re: [PATCH 2/2] KVM: SVM: Disable posted interrupts for odd IRQs



> On 3 Sep 2019, at 17:29, Alexander Graf <graf@...zon.com> wrote:
> 
> We can easily route hardware interrupts directly into VM context when
> they target the "Fixed" or "LowPriority" delivery modes.
> 
> However, on modes such as "SMI" or "Init", we need to go via KVM code
> to actually put the vCPU into a different mode of operation, so we can
> not post the interrupt
> 
> Add code in the SVM PI logic to explicitly refuse to establish posted
> mappings for advanced IRQ deliver modes.
> 
> This fixes a bug I have with code which configures real hardware to
> inject virtual SMIs into my guest.
> 
> Signed-off-by: Alexander Graf <graf@...zon.com>

Nit: I prefer to squash both commits into one that change both VMX & SVM.
As it’s exactly the same change.

> ---
> arch/x86/kvm/svm.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
> 
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 1f220a85514f..9a6ea78c3239 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -5266,6 +5266,21 @@ get_pi_vcpu_info(struct kvm *kvm, struct kvm_kernel_irq_routing_entry *e,
> 		return -1;
> 	}
> 
> +	switch (irq.delivery_mode) {
> +	case dest_Fixed:
> +	case dest_LowestPrio:
> +		break;
> +	default:
> +		/*
> +		 * For non-trivial interrupt events, we need to go
> +		 * through the full KVM IRQ code, so refuse to take
> +		 * any direct PI assignments here.
> +		 */
> +		pr_debug("SVM: %s: use legacy intr remap mode for irq %u\n",
> +			 __func__, irq.vector);
> +		return -1;
> +	}
> +

Prefer changing printed string to something different than the !kvm_intr_is_single_vcpu() case.
To assist debugging.

Having said that,
Reviewed-by: Liran Alon <liran.alon@...cle.com>

-Liran

> 	pr_debug("SVM: %s: use GA mode for irq %u\n", __func__,
> 		 irq.vector);
> 	*svm = to_svm(vcpu);
> @@ -5314,6 +5329,7 @@ static int svm_update_pi_irte(struct kvm *kvm, unsigned int host_irq,
> 		 * 1. When cannot target interrupt to a specific vcpu.
> 		 * 2. Unsetting posted interrupt.
> 		 * 3. APIC virtialization is disabled for the vcpu.
> +		 * 4. IRQ has extended delivery mode (SMI, INIT, etc)
> 		 */
> 		if (!get_pi_vcpu_info(kvm, e, &vcpu_info, &svm) && set &&
> 		    kvm_vcpu_apicv_active(&svm->vcpu)) {
> -- 
> 2.17.1
> 
> 
> 
> 
> Amazon Development Center Germany GmbH
> Krausenstr. 38
> 10117 Berlin
> Geschaeftsfuehrung: Christian Schlaeger, Ralf Herbrich
> Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
> Sitz: Berlin
> Ust-ID: DE 289 237 879
> 
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ