(
vmm_version: VmmVersionInfo,
http_path: &Option<String>,
http_fd: Option<RawFd>,
#[cfg(feature = "dbus_api")] dbus_options: Option<DBusApiOptions>,
api_event: EventFd,
api_se
| 449 | #[allow(unused_variables)] |
| 450 | #[allow(clippy::too_many_arguments)] |
| 451 | pub fn start_vmm_thread( |
| 452 | vmm_version: VmmVersionInfo, |
| 453 | http_path: &Option<String>, |
| 454 | http_fd: Option<RawFd>, |
| 455 | #[cfg(feature = "dbus_api")] dbus_options: Option<DBusApiOptions>, |
| 456 | api_event: EventFd, |
| 457 | api_sender: Sender<ApiRequest>, |
| 458 | api_receiver: Receiver<ApiRequest>, |
| 459 | #[cfg(feature = "guest_debug")] debug_path: Option<PathBuf>, |
| 460 | #[cfg(feature = "guest_debug")] debug_event: EventFd, |
| 461 | #[cfg(feature = "guest_debug")] vm_debug_event: EventFd, |
| 462 | exit_event: EventFd, |
| 463 | seccomp_action: &SeccompAction, |
| 464 | hypervisor: Arc<dyn hypervisor::Hypervisor>, |
| 465 | no_shutdown: bool, |
| 466 | landlock_enable: bool, |
| 467 | ) -> Result<VmmThreadHandle> { |
| 468 | #[cfg(feature = "guest_debug")] |
| 469 | let gdb_hw_breakpoints = hypervisor.get_guest_debug_hw_bps(); |
| 470 | #[cfg(feature = "guest_debug")] |
| 471 | let (gdb_sender, gdb_receiver) = std::sync::mpsc::channel(); |
| 472 | #[cfg(feature = "guest_debug")] |
| 473 | let gdb_debug_event = debug_event.try_clone().map_err(Error::EventFdClone)?; |
| 474 | #[cfg(feature = "guest_debug")] |
| 475 | let gdb_vm_debug_event = vm_debug_event.try_clone().map_err(Error::EventFdClone)?; |
| 476 | |
| 477 | let api_event_clone = api_event.try_clone().map_err(Error::EventFdClone)?; |
| 478 | let hypervisor_type = hypervisor.hypervisor_type(); |
| 479 | |
| 480 | // Retrieve seccomp filter |
| 481 | let vmm_seccomp_filter = get_seccomp_filter(seccomp_action, Thread::Vmm, hypervisor_type) |
| 482 | .map_err(Error::CreateSeccompFilter)?; |
| 483 | |
| 484 | let vmm_seccomp_action = seccomp_action.clone(); |
| 485 | let thread = { |
| 486 | let exit_event = exit_event.try_clone().map_err(Error::EventFdClone)?; |
| 487 | thread::Builder::new() |
| 488 | .name("vmm".to_string()) |
| 489 | .spawn(move || { |
| 490 | // Apply seccomp filter for VMM thread. |
| 491 | if !vmm_seccomp_filter.is_empty() { |
| 492 | apply_filter(&vmm_seccomp_filter).map_err(Error::ApplySeccompFilter)?; |
| 493 | } |
| 494 | |
| 495 | let mut vmm = Vmm::new( |
| 496 | vmm_version, |
| 497 | api_event, |
| 498 | #[cfg(feature = "guest_debug")] |
| 499 | debug_event, |
| 500 | #[cfg(feature = "guest_debug")] |
| 501 | vm_debug_event, |
| 502 | vmm_seccomp_action, |
| 503 | hypervisor, |
| 504 | exit_event, |
| 505 | no_shutdown, |
| 506 | )?; |
| 507 | |
| 508 | vmm.setup_signal_handler(landlock_enable)?; |
no test coverage detected