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-next>] [day] [month] [year] [list]
Date:   Fri, 23 Jun 2017 06:56:47 -0500
From:   Suravee Suthikulpanit <suravee.suthikulpanit@....com>
To:     iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org
Cc:     joro@...tes.org,
        Suravee Suthikulpanit <suravee.suthikulpanit@....com>,
        Joerg Roedel <jroedel@...e.de>
Subject: [PATCH] iommu/amd: Fix interrupt remapping when disable guest_mode

Pass-through devices to VM guest can get updated affinity
information via irq_set_affinity(). Currently, AMD IOMMU driver
in GA mode ignores the updated information if the pass-through
device is setup to use vAPIC, which could cause invalid interrupt
remapping when not running in guest_mode.

Also, the guest_mode bit should be set and cleared only when
SVM updates posted-interrupt information via irq_set_vcpu_affinity().

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@....com>
Cc: Joerg Roedel <jroedel@...e.de>
---
 drivers/iommu/amd_iommu.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index b17536d6..1055863 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -3883,7 +3883,6 @@ static void irte_ga_prepare(void *entry,
 
 	irte->lo.val                      = 0;
 	irte->hi.val                      = 0;
-	irte->lo.fields_remap.guest_mode  = dev_data ? dev_data->use_vapic : 0;
 	irte->lo.fields_remap.int_type    = delivery_mode;
 	irte->lo.fields_remap.dm          = dest_mode;
 	irte->hi.fields.vector            = vector;
@@ -3939,10 +3938,10 @@ static void irte_ga_set_affinity(void *entry, u16 devid, u16 index,
 	struct irte_ga *irte = (struct irte_ga *) entry;
 	struct iommu_dev_data *dev_data = search_dev_data(devid);
 
-	if (!dev_data || !dev_data->use_vapic) {
+	if (!dev_data || !dev_data->use_vapic ||
+	    !irte->lo.fields_remap.guest_mode) {
 		irte->hi.fields.vector = vector;
 		irte->lo.fields_remap.destination = dest_apicid;
-		irte->lo.fields_remap.guest_mode = 0;
 		modify_irte_ga(devid, index, irte, NULL);
 	}
 }
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ