From a661e53892d142da0b28c378813397b38f908ee4 Mon Sep 17 00:00:00 2001 From: Fupan Li Date: Thu, 18 Nov 2021 14:12:51 +0800 Subject: [PATCH] agent: fix the issue of missing create a new session for container When the container didn't had a tty console, it would be in a same process group with the kata-agent, which wasn't expected. Thus, create a new session for the container process. Fixes: #3063 Signed-off-by: Fupan Li --- src/agent/rustjail/src/container.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/agent/rustjail/src/container.rs b/src/agent/rustjail/src/container.rs index 03ad662872..d716c5344d 100644 --- a/src/agent/rustjail/src/container.rs +++ b/src/agent/rustjail/src/container.rs @@ -664,8 +664,8 @@ fn do_init_child(cwfd: RawFd) -> Result<()> { let _ = unistd::close(crfd); let _ = unistd::close(cwfd); + unistd::setsid().context("create a new session")?; if oci_process.terminal { - unistd::setsid()?; unsafe { libc::ioctl(0, libc::TIOCSCTTY); }