libvmm icon indicating copy to clipboard operation
libvmm copied to clipboard

virtIO devices crashing early

Open erichchan999 opened this issue 1 year ago • 3 comments

As mentioned from #70 , in the virtio example if console.c is invoked too early to handle the receiving of characters, this can cause the VMM to crash. This is due to the serial system notifying the VMM client and its processing that by accessing the virtqueues before it is initialised.

erichchan999 avatar Jun 21 '24 07:06 erichchan999

We should at least be checking the DRIVER_OK bit before doing anything.

Ivan-Velickovic avatar Jun 21 '24 07:06 Ivan-Velickovic

We also wrongly assume that the guest-physical address we're copying out of/into from virtIO descriptors is valid. We should be checking that they always lie within guest RAM.

Ivan-Velickovic avatar Jul 02 '24 04:07 Ivan-Velickovic

I've changed the title since I think it affects multiple virtIO devices we have in libvmm.

To solve this we should:

  • add checks in src/mmio.c to not invoke the callbacks registered by a virtIO device unless we have gotten the DRIVER_OK bit.
  • add asserts in each virtIO device to make sure all initialisation has occurred
  • Also be validating guest addresses given to us by the guest in the descriptor rings.

Ivan-Velickovic avatar Jul 30 '24 00:07 Ivan-Velickovic