diff --git a/src/agent/Cargo.lock b/src/agent/Cargo.lock index fb10ad35b1..ee32dc420b 100644 --- a/src/agent/Cargo.lock +++ b/src/agent/Cargo.lock @@ -631,7 +631,7 @@ dependencies = [ "logging", "netlink-packet-utils", "netlink-sys", - "nix 0.23.1", + "nix 0.24.1", "oci", "opentelemetry", "procfs", @@ -674,7 +674,7 @@ dependencies = [ "kata-types", "lazy_static", "libc", - "nix 0.23.1", + "nix 0.24.1", "oci", "once_cell", "rand 0.7.3", @@ -918,6 +918,18 @@ dependencies = [ "memoffset", ] +[[package]] +name = "nix" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f17df307904acd05aa8e32e97bb20f2a0df1728bbc2d771ae8f9a90463441e9" +dependencies = [ + "bitflags", + "cfg-if 1.0.0", + "libc", + "memoffset", +] + [[package]] name = "ntapi" version = "0.3.7" diff --git a/src/agent/Cargo.toml b/src/agent/Cargo.toml index 49c7e32a36..1d20766b2e 100644 --- a/src/agent/Cargo.toml +++ b/src/agent/Cargo.toml @@ -12,7 +12,7 @@ lazy_static = "1.3.0" ttrpc = { version = "0.6.0", features = ["async"], default-features = false } protobuf = "2.27.0" libc = "0.2.58" -nix = "0.23.0" +nix = "0.24.1" capctl = "0.2.0" serde_json = "1.0.39" scan_fmt = "0.2.3" diff --git a/src/agent/src/console.rs b/src/agent/src/console.rs index c705af1b71..8f1ae5ff32 100644 --- a/src/agent/src/console.rs +++ b/src/agent/src/console.rs @@ -9,7 +9,7 @@ use anyhow::{anyhow, Result}; use nix::fcntl::{self, FcntlArg, FdFlag, OFlag}; use nix::libc::{STDERR_FILENO, STDIN_FILENO, STDOUT_FILENO}; use nix::pty::{openpty, OpenptyResult}; -use nix::sys::socket::{self, AddressFamily, SockAddr, SockFlag, SockType}; +use nix::sys::socket::{self, AddressFamily, SockFlag, SockType, VsockAddr}; use nix::sys::stat::Mode; use nix::sys::wait; use nix::unistd::{self, close, dup2, fork, setsid, ForkResult, Pid}; @@ -67,7 +67,7 @@ pub async fn debug_console_handler( SockFlag::SOCK_CLOEXEC, None, )?; - let addr = SockAddr::new_vsock(libc::VMADDR_CID_ANY, port); + let addr = VsockAddr::new(libc::VMADDR_CID_ANY, port); socket::bind(listenfd, &addr)?; socket::listen(listenfd, 1)?; diff --git a/src/agent/src/main.rs b/src/agent/src/main.rs index 6a023e093e..ecf7a7b9df 100644 --- a/src/agent/src/main.rs +++ b/src/agent/src/main.rs @@ -22,7 +22,7 @@ extern crate slog; use anyhow::{anyhow, Context, Result}; use clap::{AppSettings, Parser}; use nix::fcntl::OFlag; -use nix::sys::socket::{self, AddressFamily, SockAddr, SockFlag, SockType}; +use nix::sys::socket::{self, AddressFamily, SockFlag, SockType, VsockAddr}; use nix::unistd::{self, dup, Pid}; use std::env; use std::ffi::OsStr; @@ -132,7 +132,7 @@ async fn create_logger_task(rfd: RawFd, vsock_port: u32, shutdown: Receiver>(mountpoint: P, lazy_umount: bool) -> Result<() // Counterpart of nix::umount2, with support of `UMOUNT_FOLLOW`. fn umount2>(path: P, lazy_umount: bool) -> std::io::Result<()> { let path_ptr = path.as_ref().as_os_str().as_bytes().as_ptr() as *const c_char; - let mut flags = UMOUNT_NOFOLLOW; + let mut flags = MntFlags::UMOUNT_NOFOLLOW.bits(); if lazy_umount { flags |= MntFlags::MNT_DETACH.bits(); } diff --git a/src/runtime-rs/Cargo.lock b/src/runtime-rs/Cargo.lock index 606170aa37..8a0b9c0b85 100644 --- a/src/runtime-rs/Cargo.lock +++ b/src/runtime-rs/Cargo.lock @@ -294,7 +294,7 @@ dependencies = [ "kata-sys-util", "kata-types", "lazy_static", - "nix 0.23.1", + "nix 0.24.1", "oci", "protobuf", "serde_json", @@ -1037,7 +1037,7 @@ dependencies = [ "kata-types", "libc", "logging", - "nix 0.16.1", + "nix 0.24.1", "seccompiler", "serde_json", "slog", @@ -1153,7 +1153,7 @@ dependencies = [ "kata-types", "lazy_static", "libc", - "nix 0.23.1", + "nix 0.24.1", "oci", "once_cell", "rand 0.7.3", @@ -1462,6 +1462,7 @@ dependencies = [ "bitflags", "cfg-if 1.0.0", "libc", + "memoffset", ] [[package]] @@ -2029,7 +2030,7 @@ dependencies = [ "logging", "netlink-packet-route", "netlink-sys", - "nix 0.16.1", + "nix 0.24.1", "oci", "rand 0.7.3", "rtnetlink", @@ -2261,7 +2262,7 @@ dependencies = [ "libc", "log", "logging", - "nix 0.23.1", + "nix 0.24.1", "oci", "protobuf", "rand 0.8.5", diff --git a/src/runtime-rs/crates/hypervisor/Cargo.toml b/src/runtime-rs/crates/hypervisor/Cargo.toml index 3201b4ee26..0de423b6bf 100644 --- a/src/runtime-rs/crates/hypervisor/Cargo.toml +++ b/src/runtime-rs/crates/hypervisor/Cargo.toml @@ -12,7 +12,7 @@ async-trait = "0.1.48" dbs-utils = "0.1.0" go-flag = "0.1.0" libc = ">=0.2.39" -nix = "0.16.1" +nix = "0.24.1" seccompiler = "0.2.0" serde_json = ">=1.0.9" slog = "2.5.2" diff --git a/src/runtime-rs/crates/resource/Cargo.toml b/src/runtime-rs/crates/resource/Cargo.toml index e5fe51bb2e..463c5d5071 100644 --- a/src/runtime-rs/crates/resource/Cargo.toml +++ b/src/runtime-rs/crates/resource/Cargo.toml @@ -14,7 +14,7 @@ lazy_static = "1.4.0" libc = ">=0.2.39" netlink-sys = "0.8.3" netlink-packet-route = "0.12.0" -nix = "0.16.0" +nix = "0.24.1" rand = "^0.7.2" rtnetlink = "0.10.0" scopeguard = "1.0.0" diff --git a/src/runtime-rs/crates/resource/src/share_fs/share_virtio_fs_standalone.rs b/src/runtime-rs/crates/resource/src/share_fs/share_virtio_fs_standalone.rs index ab0ef9af47..9c798d7467 100644 --- a/src/runtime-rs/crates/resource/src/share_fs/share_virtio_fs_standalone.rs +++ b/src/runtime-rs/crates/resource/src/share_fs/share_virtio_fs_standalone.rs @@ -128,7 +128,7 @@ impl ShareVirtioFsStandalone { info!(sl!(), "shutdown virtiofsd pid {}", pid); let pid = ::nix::unistd::Pid::from_raw(pid as i32); if let Err(err) = ::nix::sys::signal::kill(pid, nix::sys::signal::SIGKILL) { - if err != ::nix::Error::Sys(nix::errno::Errno::ESRCH) { + if err != ::nix::Error::ESRCH { return Err(anyhow!("failed to kill virtiofsd pid {} {}", pid, err)); } } diff --git a/src/runtime-rs/crates/runtimes/common/Cargo.toml b/src/runtime-rs/crates/runtimes/common/Cargo.toml index f82b4473e1..56cec862c2 100644 --- a/src/runtime-rs/crates/runtimes/common/Cargo.toml +++ b/src/runtime-rs/crates/runtimes/common/Cargo.toml @@ -11,7 +11,7 @@ anyhow = "^1.0" async-trait = "0.1.48" containerd-shim-protos = { version = "0.2.0", features = ["async"]} lazy_static = "1.4.0" -nix = "0.23.1" +nix = "0.24.1" protobuf = "2.27.0" serde_json = "1.0.39" slog = "2.5.2" diff --git a/src/runtime-rs/crates/shim/Cargo.toml b/src/runtime-rs/crates/shim/Cargo.toml index 87d0533e44..ecc0e4751d 100644 --- a/src/runtime-rs/crates/shim/Cargo.toml +++ b/src/runtime-rs/crates/shim/Cargo.toml @@ -19,7 +19,7 @@ containerd-shim-protos = { version = "0.2.0", features = ["async"]} go-flag = "0.1.0" libc = "0.2.108" log = "0.4.14" -nix = "0.23.1" +nix = "0.24.1" protobuf = "2.27.0" sha2 = "=0.9.3" slog = {version = "2.5.2", features = ["std", "release_max_level_trace", "max_level_trace"]}