diff --git a/Cargo.toml b/Cargo.toml index e07713ad..d90a770c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ async-trait = "0.1.52" futures = "0.3.19" libc = "0.2.112" log = "0.4" -nix = "0.26" +nix = "0.27" oci-spec = "0.6" os_pipe = "1.1" prost = "0.12" diff --git a/crates/runc-shim/Cargo.toml b/crates/runc-shim/Cargo.toml index e73eb2f7..deb8ce55 100644 --- a/crates/runc-shim/Cargo.toml +++ b/crates/runc-shim/Cargo.toml @@ -29,7 +29,7 @@ containerd-shim = { path = "../shim", version = "0.5.0", features = ["async"] } crossbeam = "0.8.1" libc.workspace = true log.workspace = true -nix.workspace = true +nix = {workspace = true, features = ["socket", "term", "uio"]} oci-spec.workspace = true runc = { path = "../runc", version = "0.2.0", features = ["async"] } serde.workspace = true diff --git a/crates/runc-shim/src/common.rs b/crates/runc-shim/src/common.rs index 60fa3f5f..35073301 100644 --- a/crates/runc-shim/src/common.rs +++ b/crates/runc-shim/src/common.rs @@ -25,10 +25,7 @@ use containerd_shim::{ use log::{debug, warn}; use nix::{ cmsg_space, - sys::{ - socket::{recvmsg, ControlMessageOwned, MsgFlags, UnixAddr}, - termios::tcgetattr, - }, + sys::socket::{recvmsg, ControlMessageOwned, MsgFlags, UnixAddr}, }; use oci_spec::runtime::{LinuxNamespaceType, Spec}; use runc::{ @@ -206,7 +203,6 @@ pub fn receive_socket(stream_fd: RawFd) -> containerd_shim::Result { "copy_console: console socket get path: {}, fd: {}", path, &fds[0] ); - tcgetattr(fds[0])?; Ok(fds[0]) } diff --git a/crates/runc/Cargo.toml b/crates/runc/Cargo.toml index f9e80267..eb236728 100644 --- a/crates/runc/Cargo.toml +++ b/crates/runc/Cargo.toml @@ -20,7 +20,7 @@ async = ["tokio", "async-trait", "futures", "tokio-pipe"] [dependencies] libc.workspace = true log.workspace = true -nix.workspace = true +nix = {workspace = true, features = ["user"]} oci-spec.workspace = true os_pipe.workspace = true path-absolutize = "3.0.11" diff --git a/crates/shim/Cargo.toml b/crates/shim/Cargo.toml index 36a7bbb5..3cac911e 100644 --- a/crates/shim/Cargo.toml +++ b/crates/shim/Cargo.toml @@ -37,7 +37,7 @@ go-flag = "0.1.0" lazy_static = "1.4.0" libc.workspace = true log = { workspace = true, features = ["std"]} -nix.workspace = true +nix = {workspace = true, features = ["ioctl", "mount", "socket"]} oci-spec.workspace = true page_size = "0.6.0" prctl = "1.0.0" diff --git a/crates/shim/src/util.rs b/crates/shim/src/util.rs index 4c6f74d5..4aafcc5c 100644 --- a/crates/shim/src/util.rs +++ b/crates/shim/src/util.rs @@ -15,7 +15,7 @@ */ #[cfg(unix)] -use std::os::unix::io::RawFd; +use std::os::unix::io::{AsRawFd, RawFd}; use std::time::{SystemTime, UNIX_EPOCH}; use serde::{Deserialize, Serialize}; @@ -112,7 +112,7 @@ pub fn connect(address: impl AsRef) -> Result { #[cfg(not(target_os = "linux"))] const SOCK_CLOEXEC: SockFlag = SockFlag::empty(); - let fd = socket(AddressFamily::Unix, SockType::Stream, SOCK_CLOEXEC, None)?; + let fd = socket(AddressFamily::Unix, SockType::Stream, SOCK_CLOEXEC, None)?.as_raw_fd(); // MacOS doesn't support atomic creation of a socket descriptor with `SOCK_CLOEXEC` flag, // so there is a chance of leak if fork + exec happens in between of these calls.