mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-13 13:46:46 +00:00
Merge pull request #1885 from fidencio/wip/stop-using-unmaintained-prctl-crate
agent: Stop relying in the unmaintained prctl crate
This commit is contained in:
commit
0c463babf3
466
src/agent/Cargo.lock
generated
466
src/agent/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -14,7 +14,7 @@ ttrpc = { version = "0.5.0", features = ["async", "protobuf-codec"], default-fea
|
|||||||
protobuf = "=2.14.0"
|
protobuf = "=2.14.0"
|
||||||
libc = "0.2.58"
|
libc = "0.2.58"
|
||||||
nix = "0.17.0"
|
nix = "0.17.0"
|
||||||
prctl = "1.0.0"
|
capctl = "0.2.0"
|
||||||
serde_json = "1.0.39"
|
serde_json = "1.0.39"
|
||||||
scan_fmt = "0.2.3"
|
scan_fmt = "0.2.3"
|
||||||
scopeguard = "1.0.0"
|
scopeguard = "1.0.0"
|
||||||
|
@ -13,7 +13,7 @@ protocols = { path ="../protocols" }
|
|||||||
caps = "0.5.0"
|
caps = "0.5.0"
|
||||||
nix = "0.17.0"
|
nix = "0.17.0"
|
||||||
scopeguard = "1.0.0"
|
scopeguard = "1.0.0"
|
||||||
prctl = "1.0.0"
|
capctl = "0.2.0"
|
||||||
lazy_static = "1.3.0"
|
lazy_static = "1.3.0"
|
||||||
libc = "0.2.58"
|
libc = "0.2.58"
|
||||||
protobuf = "=2.14.0"
|
protobuf = "=2.14.0"
|
||||||
|
@ -469,7 +469,7 @@ fn do_init_child(cwfd: RawFd) -> Result<()> {
|
|||||||
// Ref: https://github.com/opencontainers/runc/commit/50a19c6ff828c58e5dab13830bd3dacde268afe5
|
// Ref: https://github.com/opencontainers/runc/commit/50a19c6ff828c58e5dab13830bd3dacde268afe5
|
||||||
//
|
//
|
||||||
if !nses.is_empty() {
|
if !nses.is_empty() {
|
||||||
prctl::set_dumpable(false)
|
capctl::prctl::set_dumpable(false)
|
||||||
.map_err(|e| anyhow!(e).context("set process non-dumpable failed"))?;
|
.map_err(|e| anyhow!(e).context("set process non-dumpable failed"))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -602,7 +602,7 @@ fn do_init_child(cwfd: RawFd) -> Result<()> {
|
|||||||
|
|
||||||
// NoNewPeiviledges, Drop capabilities
|
// NoNewPeiviledges, Drop capabilities
|
||||||
if oci_process.no_new_privileges {
|
if oci_process.no_new_privileges {
|
||||||
prctl::set_no_new_privileges(true).map_err(|_| anyhow!("cannot set no new privileges"))?;
|
capctl::prctl::set_no_new_privs().map_err(|_| anyhow!("cannot set no new privileges"))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if oci_process.capabilities.is_some() {
|
if oci_process.capabilities.is_some() {
|
||||||
@ -1314,7 +1314,7 @@ fn write_mappings(logger: &Logger, path: &str, maps: &[LinuxIdMapping]) -> Resul
|
|||||||
|
|
||||||
fn setid(uid: Uid, gid: Gid) -> Result<()> {
|
fn setid(uid: Uid, gid: Gid) -> Result<()> {
|
||||||
// set uid/gid
|
// set uid/gid
|
||||||
prctl::set_keep_capabilities(true)
|
capctl::prctl::set_keepcaps(true)
|
||||||
.map_err(|e| anyhow!(e).context("set keep capabilities returned"))?;
|
.map_err(|e| anyhow!(e).context("set keep capabilities returned"))?;
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -1328,7 +1328,7 @@ fn setid(uid: Uid, gid: Gid) -> Result<()> {
|
|||||||
capabilities::reset_effective()?;
|
capabilities::reset_effective()?;
|
||||||
}
|
}
|
||||||
|
|
||||||
prctl::set_keep_capabilities(false)
|
capctl::prctl::set_keepcaps(false)
|
||||||
.map_err(|e| anyhow!(e).context("set keep capabilities returned"))?;
|
.map_err(|e| anyhow!(e).context("set keep capabilities returned"))?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -23,7 +23,7 @@ extern crate caps;
|
|||||||
extern crate protocols;
|
extern crate protocols;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate scopeguard;
|
extern crate scopeguard;
|
||||||
extern crate prctl;
|
extern crate capctl;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate lazy_static;
|
extern crate lazy_static;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate lazy_static;
|
extern crate lazy_static;
|
||||||
|
extern crate capctl;
|
||||||
extern crate oci;
|
extern crate oci;
|
||||||
extern crate prctl;
|
|
||||||
extern crate prometheus;
|
extern crate prometheus;
|
||||||
extern crate protocols;
|
extern crate protocols;
|
||||||
extern crate regex;
|
extern crate regex;
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
|
|
||||||
use crate::sandbox::Sandbox;
|
use crate::sandbox::Sandbox;
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
|
use capctl::prctl::set_subreaper;
|
||||||
use nix::sys::wait::WaitPidFlag;
|
use nix::sys::wait::WaitPidFlag;
|
||||||
use nix::sys::wait::{self, WaitStatus};
|
use nix::sys::wait::{self, WaitStatus};
|
||||||
use nix::unistd;
|
use nix::unistd;
|
||||||
use prctl::set_child_subreaper;
|
|
||||||
use slog::{error, info, o, Logger};
|
use slog::{error, info, o, Logger};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tokio::select;
|
use tokio::select;
|
||||||
@ -88,7 +88,7 @@ pub async fn setup_signal_handler(
|
|||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let logger = logger.new(o!("subsystem" => "signals"));
|
let logger = logger.new(o!("subsystem" => "signals"));
|
||||||
|
|
||||||
set_child_subreaper(true)
|
set_subreaper(true)
|
||||||
.map_err(|err| anyhow!(err).context("failed to setup agent as a child subreaper"))?;
|
.map_err(|err| anyhow!(err).context("failed to setup agent as a child subreaper"))?;
|
||||||
|
|
||||||
let mut sigchild_stream = signal(SignalKind::child())?;
|
let mut sigchild_stream = signal(SignalKind::child())?;
|
||||||
|
516
tools/agent-ctl/Cargo.lock
generated
516
tools/agent-ctl/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user