Compare commits

...

5 Commits
v20.1 ... v20.2

Author SHA1 Message Date
Rob Bradford
9f61c97e2b build: Release 20.2 (bug fix release)
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2022-01-04 17:34:55 +00:00
Sebastien Boeuf
868e566c08 virtio-devices: Forward correct evset in vsock muxer
When forwarding an epoll event from the unix muxer to the
targeted connection event handler, the eventset the connection
registered is forwarded instead of the actual epoll
operation (IN/OUT).

For example, if the connection was registered for EPOLLIN,
and receives an EPOLLOUT, the connection will actually handle
an EPOLLOUT.

This is the root cause of previous bug, which caused the
introduction of some workarounds (i.e: handling ewouldblock
when reading after receiving EPOLLIN, which should never happen).

When matching the connection, we retrieve and use the evset of
the connection instead of the one passed as a parameter.
The compiler does not complain for an unused variable because
it was first logged in a debug! statement.

This is an unfortunate naming mistake that caused a lot of problems.

Fixes #3497

Signed-off-by: Eduard Kyvenko <eduard.kyvenko@gmail.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
(cherry picked from commit c47ab55e99)
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2022-01-04 17:34:55 +00:00
Rob Bradford
0f54fb1f5f vmm: Don't assume that resize_pipe is initialised
If the underlying kernel is old PTY resize is disabled and this is
represented by the use of None in the provided Option<File> type. In the
virtio-console PTY path don't blindly unwrap() the value that will be
preserved across a reboot.

Fixes: #3496

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
(cherry picked from commit a749063c8a)
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2022-01-04 17:34:55 +00:00
Rob Bradford
758ef9604a vmm: seccomp: Remove fork & evecve syscalls
These were use for the self spawning vhost-user device feature that has
been removed.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
(cherry picked from commit bde81405a8)
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2022-01-04 17:34:55 +00:00
Rob Bradford
8768a600ff vmm: Only warn on error when setting up SIGWINCH handler
Setting up the SIGWINCH handler requires at least Linux 5.7. However
this functionality is not required for basic PTY operation.

Fixes: #3456

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
(cherry picked from commit afe386bc13)
2022-01-04 17:34:55 +00:00
7 changed files with 37 additions and 17 deletions

2
Cargo.lock generated
View File

@@ -186,7 +186,7 @@ dependencies = [
[[package]]
name = "cloud-hypervisor"
version = "20.1.0"
version = "20.2.0"
dependencies = [
"anyhow",
"api_client",

View File

@@ -1,6 +1,6 @@
[package]
name = "cloud-hypervisor"
version = "20.1.0"
version = "20.2.0"
authors = ["The Cloud Hypervisor Authors"]
edition = "2018"
default-run = "cloud-hypervisor"

View File

@@ -1,3 +1,4 @@
- [v20.2](#v202)
- [v20.1](#v201)
- [v20.0](#v200)
- [Multiple PCI segments support](#multiple-pci-segments-support)
@@ -177,6 +178,18 @@
- [Unit testing](#unit-testing)
- [Integration tests parallelization](#integration-tests-parallelization)
# v20.2
This is a bug fix release. The following issues have been addressed:
* Don't error out when setting up the SIGWINCH handler (for console resize)
when this fails due to older kernel (#3456)
* Seccomp rules were refined to remove syscalls that are now unused
* Fix reboot on older host kernels when SIGWINCH handler was not initialised
(#3496)
* Fix virtio-vsock blocking issue (#3497)
# v20.1
This is a bug fix release. The following issues have been addressed:

View File

@@ -9,7 +9,7 @@
Name: cloud-hypervisor
Summary: Cloud Hypervisor is an open source Virtual Machine Monitor (VMM) that runs on top of KVM.
Version: 20.1
Version: 20.2
Release: 0%{?dist}
License: ASL 2.0 or BSD-3-clause
Group: Applications/System
@@ -112,6 +112,9 @@ rm -rf %{buildroot}
%changelog
* Tue Jan 04 2022 Rob Bradford <robert.bradford@intel.com> 20.2-0
- Update to 20.2
* Mon Dec 13 2021 Rob Bradford <robert.bradford@intel.com> 20.1-0
- Update to 20.1

View File

@@ -362,25 +362,24 @@ impl VsockMuxer {
/// Handle/dispatch an epoll event to its listener.
///
fn handle_event(&mut self, fd: RawFd, evset: epoll::Events) {
fn handle_event(&mut self, fd: RawFd, event_set: epoll::Events) {
debug!(
"vsock: muxer processing event: fd={}, evset={:?}",
fd, evset
"vsock: muxer processing event: fd={}, event_set={:?}",
fd, event_set
);
match self.listener_map.get_mut(&fd) {
// This event needs to be forwarded to a `MuxerConnection` that is listening for
// it.
//
Some(EpollListener::Connection { key, evset }) => {
Some(EpollListener::Connection { key, evset: _ }) => {
let key_copy = *key;
let evset_copy = *evset;
// The handling of this event will most probably mutate the state of the
// receiving connection. We'll need to check for new pending RX, event set
// mutation, and all that, so we're wrapping the event delivery inside those
// checks.
self.apply_conn_mutation(key_copy, |conn| {
conn.notify(evset_copy);
conn.notify(event_set);
});
}
@@ -443,7 +442,10 @@ impl VsockMuxer {
}
_ => {
info!("vsock: unexpected event: fd={:?}, evset={:?}", fd, evset);
info!(
"vsock: unexpected event: fd={:?}, event_set={:?}",
fd, event_set
);
}
}
}

View File

@@ -1712,9 +1712,14 @@ impl DeviceManager {
let seccomp_filter =
get_seccomp_filter(&self.seccomp_action, Thread::PtyForeground).unwrap();
let pipe = start_sigwinch_listener(seccomp_filter, pty)?;
self.console_resize_pipe = Some(Arc::new(pipe));
match start_sigwinch_listener(seccomp_filter, pty) {
Ok(pipe) => {
self.console_resize_pipe = Some(Arc::new(pipe));
}
Err(e) => {
warn!("Ignoring error from setting up SIGWINCH listener: {}", e)
}
}
Ok(())
}
@@ -1737,7 +1742,7 @@ impl DeviceManager {
self.config.lock().unwrap().console.file = Some(pty.path.clone());
let file = pty.main.try_clone().unwrap();
self.console_pty = Some(Arc::new(Mutex::new(pty)));
self.console_resize_pipe = Some(Arc::new(resize_pipe.unwrap()));
self.console_resize_pipe = resize_pipe.map(Arc::new);
Endpoint::FilePair(file.try_clone().unwrap(), file)
} else {
let (main, mut sub, path) =

View File

@@ -427,14 +427,11 @@ fn vmm_thread_rules() -> Result<Vec<(i64, Vec<SeccompRule>)>, BackendError> {
#[cfg(target_arch = "x86_64")]
(libc::SYS_epoll_wait, vec![]),
(libc::SYS_eventfd2, vec![]),
(libc::SYS_execve, vec![]),
(libc::SYS_exit, vec![]),
(libc::SYS_exit_group, vec![]),
(libc::SYS_fallocate, vec![]),
(libc::SYS_fcntl, vec![]),
(libc::SYS_fdatasync, vec![]),
#[cfg(target_arch = "x86_64")]
(libc::SYS_fork, vec![]),
(libc::SYS_fstat, vec![]),
(libc::SYS_fsync, vec![]),
(libc::SYS_ftruncate, vec![]),