-
Notifications
You must be signed in to change notification settings - Fork 565
Description
Summary
cloud-hypervisor vm is crashing if we connect to VSOCK socket from the host side and kill the app with +c without connecting to any port. If we connect to some port where guest VM is listening, then it disconnects without crashing.
I was able to consistently reproduce this using ncat/socat and custom applications on two different setups.
Expected Result
VM should not have crashed in any scenario
Consistency
YES, the bug is consistently reproducible and can be reproduced with the steps mentioned.
Host Machine Details
Setup 1:
Architecture = x86_64
Operating_System = Ubuntu 22.04
Kernel_Version = 6.2
Setup 2:
Architecture = x86_64
Operating_System = Ubuntu 20.04.6 LTS
Kernel_Version = 5.4.0-182-generic
VM Image Details
Kernel = ./linux-cloud-hypervisor/arch/x86/boot/compressed/vmlinux.bin
Image = jammy-server-cloudimg-amd64-disk-kvm.raw
Steps to reproduce the bug
Step 1: Launch the VM using the below command with vsock socket enabled.
./cloud-hypervisor \
--kernel ./linux-cloud-hypervisor/arch/x86/boot/compressed/vmlinux.bin\
--console off \
--serial tty \
--disk path=jammy-server-cloudimg-amd64-disk-kvm.raw \
--cmdline "console=ttyS0 root=/dev/vda1 rw" \
--cpus boot=4 \
--memory size=2048M,shared=on \
--net fd=3,mac=$mac 3<>"$tapdevice" \
--api-socket=/tmp/ch-socket-$part_name \
--vsock "cid=33,socket=/tmp/vsock-$part_name.sock"
Step 2: From the host, launch ncat to connect to that socket
Step 3: Kill ncat with +c
Cloud Hypervisor version Info
# ./cloud-hypervisor --version
cloud-hypervisor v40.0.0
/linux-cloud-hypervisor# git show
commit 65965832503d55422a67e653e01aefa6c2c9cabc (grafted, HEAD -> ch-6.2, origin/ch-6.2)
Author: Rob Bradford <[email protected]>
Date: Mon Jan 11 10:19:52 2021 +0000
README.md: Add Cloud Hypervisor specific details
Signed-off-by: Rob Bradford <[email protected]>
Logs observed
From Host OS
# ncat -U /tmp/vsock-P1.sock
^C
From Guest VM
Ubuntu 22.04.4 LTS ubuntu ttyS0
ubuntu login: root
Password:
Welcome to Ubuntu 22.04.4 LTS (GNU/Linux 6.2.0+ x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro
System information as of Tue Jul 30 19:44:03 UTC 2024
System load: 0.0 Memory usage: 9% Processes: 101
Usage of /: 73.4% of 1.96GB Swap usage: 0% Users logged in: 0
Expanded Security Maintenance for Applications is not enabled.
0 updates can be applied immediately.
Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status
Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings
Last login: Tue Jul 30 19:30:05 UTC 2024 on ttyS0
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# thread '_vsock2' panicked at virtio-devices/src/vsock/unix/muxer.rs:507:15:
index out of bounds: the len is 32 but the index is 18446744073709551615
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
cloud-hypervisor: 293.804975s: <_vsock2> ERROR:virtio-devices/src/thread_helper.rs:50 -- _vsock2 thread panicked
Metadata
Metadata
Assignees
Labels
Type
Projects
Status