From ad09197e41ecf754ed89cdfc6557948561c3523f Mon Sep 17 00:00:00 2001 From: lifubang Date: Sat, 22 Feb 2025 16:40:18 +0000 Subject: [PATCH] libct: don't send config to nsexec when joining an existing timens We should configure the process's timens offset only when we need to create new time namespace, we shouldn't do it if we are joining an existing time namespace. (#4635) Signed-off-by: lifubang --- libcontainer/container_linux.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libcontainer/container_linux.go b/libcontainer/container_linux.go index 54a0eaafe..e913fef0b 100644 --- a/libcontainer/container_linux.go +++ b/libcontainer/container_linux.go @@ -1146,8 +1146,9 @@ func (c *Container) bootstrapData(cloneFlags uintptr, nsMaps map[configs.Namespa Value: c.config.RootlessEUID, }) - // write boottime and monotonic time ns offsets. - if c.config.TimeOffsets != nil { + // write boottime and monotonic time ns offsets only when we are not joining an existing time ns + _, joinExistingTime := nsMaps[configs.NEWTIME] + if !joinExistingTime && c.config.TimeOffsets != nil { var offsetSpec bytes.Buffer for clock, offset := range c.config.TimeOffsets { fmt.Fprintf(&offsetSpec, "%s %d %d\n", clock, offset.Secs, offset.Nanosecs)