[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 42/45] ARM: new VGIC: vgic-init: implement vgic_init



Hi Andre,

On 03/15/2018 08:30 PM, Andre Przywara wrote:
+/* INIT/DESTROY */
+
+/**
+ * domain_vgic_init: initialize the dist data structures
+ * @d: domain pointer
+ * @nr_spis: number of SPIs
+ */
+int domain_vgic_init(struct domain *d, unsigned int nr_spis)
+{
+    struct vgic_dist *dist = &d->arch.vgic;
+    unsigned int i;
+    int ret;
+
+    /* Limit the number of virtual SPIs supported to (1020 - 32) = 988  */
+    if ( nr_spis > (1020 - NR_LOCAL_IRQS) )
+        return -EINVAL;
+    nr_spis = ROUNDUP(nr_spis, 32);

I think the roundup is misplaced. Here you might allow the guest to inject IRQs 1020-1023. From the Spec, using those values in the LRs for the vINTID field will result to unpredictable behavior.

So you want to move the ROUNDUP before the check. This will limit the SPI INT ID to 992, but this is not a big deal for now.


Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.