-
Notifications
You must be signed in to change notification settings - Fork 47
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
vsock: Implement sibling VM communication #370
vsock: Implement sibling VM communication #370
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job!
I left several minor comments. I recommend that you add an example of how you tested the patch in the commit message.
Another thing I think we should put in is something to decide whether 2 VMs should communicate or not.
One idea would be to add a new "group" parameter to each VM and have only the VMs in the same "group" communicate.
Obviously we can do that later, but I wanted to tell you before I forget.
Ah I think we should extend the README and say if you add more VMs they can communicate with each other. Another thing I have to check now that we have more VMs, is that the packets received from a VM have the right src_cid, otherwise one might impersonate another. I think we didn't have this check before, but now we should since we have more VMs. |
214a648
to
4477490
Compare
For testing, I used https://github.com/stefanha/nc-vsock/blob/master/nc-vsock.c with this patch:
Should I mention all this in the commit message, or should I make a fork with this patch applied and then link to it? |
Should be fine something like:
|
I am getting a cargo audit error in the checks. Should I commit the rebuilt cargo lock file by running |
Do you have the same issue on the If it is the case, will be better to have another PR. |
Yes
Okay |
I've created the PR fixing |
fee5af1
to
43d8514
Compare
Rebased over main now that #371 has been merged. |
334d98a
to
1025a45
Compare
@techiepriyansh the final result LGTM! The only thing I'd suggest is to reorganize the commits, I'd move the new 2 commits, before the one that adds support for communication between multiple VMs, so we don't add code (e.g. |
1025a45
to
ed2d1b4
Compare
I've now moved the commit handling the single VM case same as multiple VMs before the commit implementing sibling VM communication. I've not moved the commit checking the packet source CID yet because I think it makes more sense to put it afterwards, but do let me know if I need to move it back too. |
LGTM! |
In future, we could add the ability to change the configuration at runtime and allow new guests to be added even without having to restart the daemon. So it is reasonable to not differentiate between the single and multiple VM cases, even with only one guest. Signed-off-by: Priyansh Rathi <techiepriyansh@gmail.com>
Adds support for communication between sibling VMs that use the vhost-user-vsock devices from the same vhost-user-vsock application. Tested with nc-vsock patched to set `.svm_flags = VMADDR_FLAG_TO_HOST`: host$ vhost-user-vsock \ --vm guest-cid=3,uds-path=/tmp/vm3.vsock,socket=/tmp/vhost3.socket \ --vm guest-cid=4,uds-path=/tmp/vm4.vsock,socket=/tmp/vhost4.socket vm_cid3$ nc-vsock -l 1234 vm_cid4$ nc-vsock 3 1234 Signed-off-by: Priyansh Rathi <techiepriyansh@gmail.com>
Cross-check the packet `src_cid` with the CID configured for the guest. This will forbid a VM from impersonating another. Signed-off-by: Priyansh Rathi <techiepriyansh@gmail.com>
ed2d1b4
to
89ed07c
Compare
Adds support for communication between sibling VMs that use the vhost-user-vsock devices from the same vhost-user-vsock application.