]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
Fixes: a5e25908d18d ('VT-d: introduce new fields in msi_desc to track binding with...
authorRoger Pau Monne <roger.pau@citrix.com>
Mon, 10 Mar 2025 15:49:29 +0000 (16:49 +0100)
committerRoger Pau Monne <roger.pau@citrix.com>
Mon, 10 Mar 2025 16:56:17 +0000 (17:56 +0100)
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
xen/arch/x86/hvm/vmx/vmx.c
xen/arch/x86/include/asm/msi.h

index 0241303b4bf4ecd17bffa654b0728e8b9394c5be..c407513af624a3c983b0e59ddfcafeaeff14851f 100644 (file)
@@ -396,6 +396,13 @@ static int cf_check vmx_pi_update_irte(const struct vcpu *v,
     const struct pi_desc *pi_desc = v ? &v->arch.hvm.vmx.pi_desc : NULL;
     struct irq_desc *desc;
     struct msi_desc *msi_desc;
+    /*
+     * vmx_pi_update_irte() relies on the IRTE already being setup, and just
+     * updates the guest vector, but not the other IRTE fields.  As such the
+     * contents of msg are not consumed by iommu_update_ire_from_msi().  Even
+     * if not consumed, zero the contents to avoid possible stack leaks.
+     */
+    struct msi_msg msg = {};
     int rc;
 
     desc = pirq_spin_lock_irq_desc(pirq, NULL);
@@ -415,7 +422,7 @@ static int cf_check vmx_pi_update_irte(const struct vcpu *v,
 
     ASSERT_PDEV_LIST_IS_READ_LOCKED(msi_desc->dev->domain);
 
-    return iommu_update_ire_from_msi(msi_desc, &msi_desc->msg);
+    return iommu_update_ire_from_msi(msi_desc, &msg);
 
  unlock_out:
     spin_unlock_irq(&desc->lock);
index 378b85ee947b1472ff512d18444ca9a0334776bf..975d0f26b35d9b42bc0fa511dedc0c872294279f 100644 (file)
@@ -124,7 +124,7 @@ struct msi_desc {
     int irq;
     int remap_index;         /* index in interrupt remapping table */
 
-    struct msi_msg msg;      /* Last set MSI message */
+    struct msi_msg msg;      /* Last set MSI message (untranslated) */
 };
 
 /*