From d0750587170eff849d5f26f55a6409b33ac2fe9a Mon Sep 17 00:00:00 2001 From: lifubang Date: Tue, 6 Feb 2024 16:33:41 +0800 Subject: [PATCH] close the sync pipe explicitly in exec Signed-off-by: lifubang --- libcontainer/setns_init_linux.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libcontainer/setns_init_linux.go b/libcontainer/setns_init_linux.go index 4a458fcbe..ba48604d9 100644 --- a/libcontainer/setns_init_linux.go +++ b/libcontainer/setns_init_linux.go @@ -129,6 +129,11 @@ func (l *linuxSetnsInit) Init() error { } } + // Close the pipe to signal that we have completed our init. + // Please keep this because we don't want to get a pipe write error if + // there is an error from `execve` after all fds closed. + _ = l.pipe.Close() + // Close the log pipe fd so the parent's ForwardLogs can exit. logrus.Debugf("setns_init: about to exec") if err := l.logPipe.Close(); err != nil {