mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices, vmm: Fix the '--seccomp false' option
We are relying on applying empty 'seccomp' filters to support the '--seccomp false' option, which will be treated as an error with the updated 'seccompiler' crate. This patch fixes this issue by explicitly checking whether the 'seccomp' filter is empty before applying the filter. Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
@@ -466,9 +466,13 @@ impl VirtioDevice for Balloon {
|
||||
thread::Builder::new()
|
||||
.name(self.id.clone())
|
||||
.spawn(move || {
|
||||
if let Err(e) = apply_filter(&virtio_balloon_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
} else if let Err(e) = handler.run(paused, paused_sync.unwrap()) {
|
||||
if !virtio_balloon_seccomp_filter.is_empty() {
|
||||
if let Err(e) = apply_filter(&virtio_balloon_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if let Err(e) = handler.run(paused, paused_sync.unwrap()) {
|
||||
error!("Error running worker: {:?}", e);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -596,9 +596,13 @@ impl VirtioDevice for Block {
|
||||
thread::Builder::new()
|
||||
.name(format!("{}_q{}", self.id.clone(), i))
|
||||
.spawn(move || {
|
||||
if let Err(e) = apply_filter(&virtio_block_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
} else if let Err(e) = handler.run(paused, paused_sync.unwrap()) {
|
||||
if !virtio_block_seccomp_filter.is_empty() {
|
||||
if let Err(e) = apply_filter(&virtio_block_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if let Err(e) = handler.run(paused, paused_sync.unwrap()) {
|
||||
error!("Error running worker: {:?}", e);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -429,9 +429,13 @@ impl VirtioDevice for Console {
|
||||
thread::Builder::new()
|
||||
.name(self.id.clone())
|
||||
.spawn(move || {
|
||||
if let Err(e) = apply_filter(&virtio_console_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
} else if let Err(e) = handler.run(paused, paused_sync.unwrap()) {
|
||||
if !virtio_console_seccomp_filter.is_empty() {
|
||||
if let Err(e) = apply_filter(&virtio_console_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if let Err(e) = handler.run(paused, paused_sync.unwrap()) {
|
||||
error!("Error running worker: {:?}", e);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -850,9 +850,14 @@ impl VirtioDevice for Iommu {
|
||||
thread::Builder::new()
|
||||
.name(self.id.clone())
|
||||
.spawn(move || {
|
||||
if let Err(e) = apply_filter(&virtio_iommu_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
} else if let Err(e) = handler.run(paused, paused_sync.unwrap()) {
|
||||
if !virtio_iommu_seccomp_filter.is_empty() {
|
||||
if let Err(e) = apply_filter(&virtio_iommu_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if let Err(e) = handler.run(paused, paused_sync.unwrap()) {
|
||||
error!("Error running worker: {:?}", e);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -961,9 +961,13 @@ impl VirtioDevice for Mem {
|
||||
thread::Builder::new()
|
||||
.name(self.id.clone())
|
||||
.spawn(move || {
|
||||
if let Err(e) = apply_filter(&virtio_mem_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
} else if let Err(e) = handler.run(paused, paused_sync.unwrap()) {
|
||||
if !virtio_mem_seccomp_filter.is_empty() {
|
||||
if let Err(e) = apply_filter(&virtio_mem_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if let Err(e) = handler.run(paused, paused_sync.unwrap()) {
|
||||
error!("Error running worker: {:?}", e);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -576,9 +576,13 @@ impl VirtioDevice for Net {
|
||||
thread::Builder::new()
|
||||
.name(format!("{}_ctrl", self.id))
|
||||
.spawn(move || {
|
||||
if let Err(e) = apply_filter(&virtio_net_ctl_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
} else if let Err(e) = ctrl_handler.run_ctrl(paused, paused_sync.unwrap()) {
|
||||
if !virtio_net_ctl_seccomp_filter.is_empty() {
|
||||
if let Err(e) = apply_filter(&virtio_net_ctl_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if let Err(e) = ctrl_handler.run_ctrl(paused, paused_sync.unwrap()) {
|
||||
error!("Error running worker: {:?}", e);
|
||||
}
|
||||
})
|
||||
@@ -659,9 +663,13 @@ impl VirtioDevice for Net {
|
||||
thread::Builder::new()
|
||||
.name(format!("{}_qp{}", self.id.clone(), i))
|
||||
.spawn(move || {
|
||||
if let Err(e) = apply_filter(&virtio_net_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
} else if let Err(e) = handler.run(paused, paused_sync.unwrap()) {
|
||||
if !virtio_net_seccomp_filter.is_empty() {
|
||||
if let Err(e) = apply_filter(&virtio_net_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if let Err(e) = handler.run(paused, paused_sync.unwrap()) {
|
||||
error!("Error running worker: {:?}", e);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -397,9 +397,13 @@ impl VirtioDevice for Pmem {
|
||||
thread::Builder::new()
|
||||
.name(self.id.clone())
|
||||
.spawn(move || {
|
||||
if let Err(e) = apply_filter(&virtio_pmem_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
} else if let Err(e) = handler.run(paused, paused_sync.unwrap()) {
|
||||
if !virtio_pmem_seccomp_filter.is_empty() {
|
||||
if let Err(e) = apply_filter(&virtio_pmem_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if let Err(e) = handler.run(paused, paused_sync.unwrap()) {
|
||||
error!("Error running worker: {:?}", e);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -243,9 +243,13 @@ impl VirtioDevice for Rng {
|
||||
thread::Builder::new()
|
||||
.name(self.id.clone())
|
||||
.spawn(move || {
|
||||
if let Err(e) = apply_filter(&virtio_rng_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
} else if let Err(e) = handler.run(paused, paused_sync.unwrap()) {
|
||||
if !virtio_rng_seccomp_filter.is_empty() {
|
||||
if let Err(e) = apply_filter(&virtio_rng_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if let Err(e) = handler.run(paused, paused_sync.unwrap()) {
|
||||
error!("Error running worker: {:?}", e);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -556,9 +556,13 @@ impl VirtioDevice for Fs {
|
||||
thread::Builder::new()
|
||||
.name(self.id.to_string())
|
||||
.spawn(move || {
|
||||
if let Err(e) = apply_filter(&virtio_vhost_fs_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
} else if let Err(e) = handler.run(paused, paused_sync.unwrap()) {
|
||||
if !virtio_vhost_fs_seccomp_filter.is_empty() {
|
||||
if let Err(e) = apply_filter(&virtio_vhost_fs_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if let Err(e) = handler.run(paused, paused_sync.unwrap()) {
|
||||
error!("Error running vhost-user-fs worker: {:?}", e);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -339,9 +339,13 @@ impl VirtioDevice for Net {
|
||||
thread::Builder::new()
|
||||
.name(format!("{}_ctrl", self.id))
|
||||
.spawn(move || {
|
||||
if let Err(e) = apply_filter(&virtio_vhost_net_ctl_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
} else if let Err(e) = ctrl_handler.run_ctrl(paused, paused_sync.unwrap()) {
|
||||
if !virtio_vhost_net_ctl_seccomp_filter.is_empty() {
|
||||
if let Err(e) = apply_filter(&virtio_vhost_net_ctl_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if let Err(e) = ctrl_handler.run_ctrl(paused, paused_sync.unwrap()) {
|
||||
error!("Error running worker: {:?}", e);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -441,9 +441,13 @@ where
|
||||
thread::Builder::new()
|
||||
.name(self.id.clone())
|
||||
.spawn(move || {
|
||||
if let Err(e) = apply_filter(&virtio_vsock_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
} else if let Err(e) = handler.run(paused, paused_sync.unwrap()) {
|
||||
if !virtio_vsock_seccomp_filter.is_empty() {
|
||||
if let Err(e) = apply_filter(&virtio_vsock_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if let Err(e) = handler.run(paused, paused_sync.unwrap()) {
|
||||
error!("Error running worker: {:?}", e);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -325,9 +325,14 @@ impl VirtioDevice for Watchdog {
|
||||
thread::Builder::new()
|
||||
.name(self.id.clone())
|
||||
.spawn(move || {
|
||||
if let Err(e) = apply_filter(&virtio_watchdog_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
} else if let Err(e) = handler.run(paused, paused_sync.unwrap()) {
|
||||
if !virtio_watchdog_seccomp_filter.is_empty() {
|
||||
if let Err(e) = apply_filter(&virtio_watchdog_seccomp_filter) {
|
||||
error!("Error applying seccomp filter: {:?}", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if let Err(e) = handler.run(paused, paused_sync.unwrap()) {
|
||||
error!("Error running worker: {:?}", e);
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user