mirror of
				https://github.com/kata-containers/kata-containers.git
				synced 2025-11-04 03:29:55 +00:00 
			
		
		
		
	agent: exec should inherit container process capabilities
Otherwise rustjail would not set its capabilities and it ends up getting all capabilities. Fixes: #2828 Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
		@@ -833,6 +833,20 @@ impl BaseContainer for LinuxContainer {
 | 
			
		||||
        }
 | 
			
		||||
        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 _ = fcntl::fcntl(pfd_log, FcntlArg::F_SETFD(FdFlag::FD_CLOEXEC))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user