Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

virtIO devices crashing early #71

Open
erichchan999 opened this issue Jun 21, 2024 · 3 comments
Open

virtIO devices crashing early #71

erichchan999 opened this issue Jun 21, 2024 · 3 comments

Comments

@erichchan999
Copy link
Contributor

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.

@Ivan-Velickovic
Copy link
Collaborator

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

@Ivan-Velickovic
Copy link
Collaborator

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 Ivan-Velickovic changed the title VirtIO console early crashing virtIO devices crashing early Jul 30, 2024
@Ivan-Velickovic
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants