kata-sys-util: upgrade nix version

New nix is supporting UMOUNT_NOFOLLOW, upgrade nix
version to use this flag instead of the self-defined flag.

Fixes: #4670

Signed-off-by: liubin <liubin0329@gmail.com>
This commit is contained in:
liubin 2022-07-15 16:50:29 +08:00
parent 9f49f7adca
commit 996a6b80bc
12 changed files with 32 additions and 22 deletions

16
src/agent/Cargo.lock generated
View File

@ -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"

View File

@ -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"

View File

@ -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)?;

View File

@ -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<bool
None,
)?;
let addr = SockAddr::new_vsock(libc::VMADDR_CID_ANY, vsock_port);
let addr = VsockAddr::new(libc::VMADDR_CID_ANY, vsock_port);
socket::bind(listenfd, &addr)?;
socket::listen(listenfd, 1)?;

View File

@ -18,7 +18,7 @@ common-path = "=1.0.0"
fail = "0.5.0"
lazy_static = "1.4.0"
libc = "0.2.100"
nix = "0.23.0"
nix = "0.24.1"
once_cell = "1.9.0"
serde_json = "1.0.73"
slog = "2.5.2"

View File

@ -68,9 +68,6 @@ const PROC_DEVICE_INDEX: usize = 0;
const PROC_PATH_INDEX: usize = 1;
const PROC_TYPE_INDEX: usize = 2;
// Sadly nix/libc doesn't have UMOUNT_NOFOLLOW although it's there since Linux 2.6.34
const UMOUNT_NOFOLLOW: i32 = 0x8;
lazy_static! {
static ref MAX_MOUNT_PARAM_SIZE: usize =
if let Ok(Some(v)) = unistd::sysconf(unistd::SysconfVar::PAGE_SIZE) {
@ -763,7 +760,7 @@ pub fn umount_all<P: AsRef<Path>>(mountpoint: P, lazy_umount: bool) -> Result<()
// Counterpart of nix::umount2, with support of `UMOUNT_FOLLOW`.
fn umount2<P: AsRef<Path>>(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();
}

View File

@ -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",

View File

@ -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"

View File

@ -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"

View File

@ -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));
}
}

View File

@ -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"

View File

@ -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"]}