mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-29 08:47:56 +00:00
Merge pull request #2829 from bergwolf/capability
agent: exec should inherit container process capabilities
This commit is contained in:
commit
6cc4d6b54e
@ -833,6 +833,20 @@ impl BaseContainer for LinuxContainer {
|
|||||||
}
|
}
|
||||||
let linux = spec.linux.as_ref().unwrap();
|
let linux = spec.linux.as_ref().unwrap();
|
||||||
|
|
||||||
|
if p.oci.capabilities.is_none() {
|
||||||
|
// No capabilities, inherit from container process
|
||||||
|
let process = spec
|
||||||
|
.process
|
||||||
|
.as_ref()
|
||||||
|
.ok_or_else(|| anyhow!("no process config"))?;
|
||||||
|
p.oci.capabilities = Some(
|
||||||
|
process
|
||||||
|
.capabilities
|
||||||
|
.clone()
|
||||||
|
.ok_or_else(|| anyhow!("missing process capabilities"))?,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let (pfd_log, cfd_log) = unistd::pipe().context("failed to create pipe")?;
|
let (pfd_log, cfd_log) = unistd::pipe().context("failed to create pipe")?;
|
||||||
|
|
||||||
let _ = fcntl::fcntl(pfd_log, FcntlArg::F_SETFD(FdFlag::FD_CLOEXEC))
|
let _ = fcntl::fcntl(pfd_log, FcntlArg::F_SETFD(FdFlag::FD_CLOEXEC))
|
||||||
|
Loading…
Reference in New Issue
Block a user