Skip to contentSkip to conversation

x86/vMsi-x: check whether msixtbl_list in msixtbl_pt_register()

PATCH In review Chao Gao 2 participants 2 messages Jul 30, 2016 – Aug 1, 2016

lore
Share & tools
lore

Chao Gao

author
#0 lore raw

PATCH 1/1 x86/vMsi-x: check whether msixtbl_list in msixtbl_pt_register()

MSI-x tables' initializtion had been deferred in the commit 74c6dc2d0ac4dcab0c6243cdf6ed550c1532b798. If an assigned device does not support MSI-x, the msixtbl_list won't be initialized. However, the following paths
XEN_DOMCTL_bind_pt_irq
pt_irq_create_bind
msixtbl_pt_register
do not check this case. Some errors(malwares, etc.) may lead to calling XEN_DOMCTL_bind_pt_irq without a clear gtable and will cause Xen panic.

---
 xen/arch/x86/hvm/vmsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/hvm/vmsi.c +1 -1
index ef1dfff..d81c5d4 100644
@@ -459,7 +459,7 @@ int msixtbl_pt_register(struct domain *d, struct pirq *pirq, uint64_t gtable)
     ASSERT(pcidevs_locked());
     ASSERT(spin_is_locked(&d->event_lock));
 
-    if ( !has_vlapic(d) )
+    if ( !msixtbl_initialised(d) )
         return -ENODEV;
 
     /*
Signature · 7 lines
1.8.3.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Chao Gao

MSI-x tables' initializtion had been deferred in the commit 74c6dc2d0ac4dcab0c6243cdf6ed550c1532b798. If an assigned device does not support MSI-x, the msixtbl_list won't be initialized. However, the following paths
XEN_DOMCTL_bind_pt_irq
pt_irq_create_bind
msixtbl_pt_register
do not check this case. Some errors(malwares, etc.) may lead to calling XEN_DOMCTL_bind_pt_irq without a clear gtable and will cause Xen panic.

Quoted 9 lines
---
 xen/arch/x86/hvm/vmsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/hvm/vmsi.c +0 -0
index ef1dfff..d81c5d4 100644

xen/arch/x86/hvm/vmsi.c int msixtbl_pt_register(struct domain *d, struct pirq *pirq, uint64_t gtable) · line 465

Quoted 8 lines
xen/arch/x86/hvm/vmsi.c +1 -1
@@ -459,7 +459,7 @@ int msixtbl_pt_register(struct domain *d, struct pirq *pirq, uint64_t gtable)
     ASSERT(pcidevs_locked());
     ASSERT(spin_is_locked(&d->event_lock));
 
-    if ( !has_vlapic(d) )
+    if ( !msixtbl_initialised(d) )
         return -ENODEV;
 
     /*

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel