quic / gunyah-hypervisor

Gunyah is a Type-1 hypervisor designed for strong security, performance and modularity.
Other
313 stars 58 forks source link

An error in forward_private.c #17

Closed SuperMMe closed 1 year ago

SuperMMe commented 1 year ago

error_t vic_bind_hwirq_forward_private(vic_t vic, hwirq_t hwirq, virq_t virq) { error_t err = OK;

assert(hwirq->action == HWIRQ_ACTION_VIC_BASE_FORWARD_PRIVATE);

LOG(ERROR, WARN, "vic_bind_hwirq_forward_private virq {:x}", (unsigned long)virq);

// allocate for private forward
struct partition *partition = vic->header.partition;
assert(partition != NULL);

size_t size = sizeof(hwirq->vic_base_forward_private[0]) * GIC_PPI_NUM;  //here, GIC_PPI_NUM shoud be cpu count.
    //let's see how to use it later
   //       vic_forward_private_t *forward_private =
   //             &hwirq->vic_base_forward_private[pcpu];  
  // Am I right?

void_ptr_result_t alloc_r = partition_alloc(
    partition, size, alignof(hwirq->vic_base_forward_private[0]));
if (alloc_r.e != OK) {
    err = ERROR_NOMEM;
    goto out;
}
quic-cvanscha commented 1 year ago

Correct, this looks like this is a real issue! Fortunately, GIC_PPI_NUM is larger than the cpu count. I'll look into a fix.

quic-cvanscha commented 1 year ago

This was already fixed in 4a4f0af.