From f21675c2731774c54412b3855a9eb43a757f69c4 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 25 Jul 2024 11:12:27 +0200 Subject: [PATCH 1/3] vendor: github.com/moby/sys/user v0.2.0 full diff: https://github.com/moby/sys/compare/user/v0.1.0...user/v0.2.0 Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 40a315b95c78b2e910a95450adfa25d074ae0c22) Signed-off-by: Sebastiaan van Stijn --- go.mod | 2 +- go.sum | 4 ++-- integration/client/go.mod | 2 +- integration/client/go.sum | 4 ++-- vendor/github.com/moby/sys/user/user.go | 1 - vendor/modules.txt | 4 ++-- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 2072f710f0..084a39fbf8 100644 --- a/go.mod +++ b/go.mod @@ -48,7 +48,7 @@ require ( github.com/moby/sys/sequential v0.5.0 github.com/moby/sys/signal v0.7.0 github.com/moby/sys/symlink v0.2.0 - github.com/moby/sys/user v0.1.0 + github.com/moby/sys/user v0.2.0 github.com/opencontainers/go-digest v1.0.0 github.com/opencontainers/image-spec v1.1.0 github.com/opencontainers/runtime-spec v1.1.0 diff --git a/go.sum b/go.sum index 92f221988a..632a8ed7f5 100644 --- a/go.sum +++ b/go.sum @@ -545,8 +545,8 @@ github.com/moby/sys/signal v0.7.0/go.mod h1:GQ6ObYZfqacOwTtlXvcmh9A26dVRul/hbOZn github.com/moby/sys/symlink v0.1.0/go.mod h1:GGDODQmbFOjFsXvfLVn3+ZRxkch54RkSiGqsZeMYowQ= github.com/moby/sys/symlink v0.2.0 h1:tk1rOM+Ljp0nFmfOIBtlV3rTDlWOwFRhjEeAhZB0nZc= github.com/moby/sys/symlink v0.2.0/go.mod h1:7uZVF2dqJjG/NsClqul95CqKOBRQyYSNnJ6BMgR/gFs= -github.com/moby/sys/user v0.1.0 h1:WmZ93f5Ux6het5iituh9x2zAG7NFY9Aqi49jjE1PaQg= -github.com/moby/sys/user v0.1.0/go.mod h1:fKJhFOnsCN6xZ5gSfbM6zaHGgDJMrqt9/reuj4T7MmU= +github.com/moby/sys/user v0.2.0 h1:OnpapJsRp25vkhw8TFG6OLJODNh/3rEwRWtJ3kakwRM= +github.com/moby/sys/user v0.2.0/go.mod h1:RYstrcWOJpVh+6qzUqp2bU3eaRpdiQeKGlKitaH0PM8= github.com/moby/term v0.0.0-20200312100748-672ec06f55cd/go.mod h1:DdlQx2hp0Ss5/fLikoLlEeIYiATotOjgB//nb973jeo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= diff --git a/integration/client/go.mod b/integration/client/go.mod index 303a50c66f..5d4c14442a 100644 --- a/integration/client/go.mod +++ b/integration/client/go.mod @@ -52,7 +52,7 @@ require ( github.com/moby/sys/mountinfo v0.6.2 // indirect github.com/moby/sys/sequential v0.5.0 // indirect github.com/moby/sys/signal v0.7.0 // indirect - github.com/moby/sys/user v0.1.0 // indirect + github.com/moby/sys/user v0.2.0 // indirect github.com/opencontainers/selinux v1.11.0 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pkg/errors v0.9.1 // indirect diff --git a/integration/client/go.sum b/integration/client/go.sum index e3e76a1b90..79af20d5b8 100644 --- a/integration/client/go.sum +++ b/integration/client/go.sum @@ -1820,8 +1820,8 @@ github.com/moby/sys/signal v0.6.0/go.mod h1:GQ6ObYZfqacOwTtlXvcmh9A26dVRul/hbOZn github.com/moby/sys/signal v0.7.0 h1:25RW3d5TnQEoKvRbEKUGay6DCQ46IxAVTT9CUMgmsSI= github.com/moby/sys/signal v0.7.0/go.mod h1:GQ6ObYZfqacOwTtlXvcmh9A26dVRul/hbOZn88Kg8Tg= github.com/moby/sys/symlink v0.2.0/go.mod h1:7uZVF2dqJjG/NsClqul95CqKOBRQyYSNnJ6BMgR/gFs= -github.com/moby/sys/user v0.1.0 h1:WmZ93f5Ux6het5iituh9x2zAG7NFY9Aqi49jjE1PaQg= -github.com/moby/sys/user v0.1.0/go.mod h1:fKJhFOnsCN6xZ5gSfbM6zaHGgDJMrqt9/reuj4T7MmU= +github.com/moby/sys/user v0.2.0 h1:OnpapJsRp25vkhw8TFG6OLJODNh/3rEwRWtJ3kakwRM= +github.com/moby/sys/user v0.2.0/go.mod h1:RYstrcWOJpVh+6qzUqp2bU3eaRpdiQeKGlKitaH0PM8= github.com/moby/term v0.0.0-20210610120745-9d4ed1856297/go.mod h1:vgPCkQMyxTZ7IDy8SXRufE172gr8+K/JE/7hHFxHW3A= github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= diff --git a/vendor/github.com/moby/sys/user/user.go b/vendor/github.com/moby/sys/user/user.go index 984466d1ab..198c493679 100644 --- a/vendor/github.com/moby/sys/user/user.go +++ b/vendor/github.com/moby/sys/user/user.go @@ -197,7 +197,6 @@ func ParseGroupFilter(r io.Reader, filter func(Group) bool) ([]Group, error) { for { var line []byte line, isPrefix, err = rd.ReadLine() - if err != nil { // We should return no error if EOF is reached // without a match. diff --git a/vendor/modules.txt b/vendor/modules.txt index df74d5c1cd..2a0cae9d33 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -366,8 +366,8 @@ github.com/moby/sys/signal # github.com/moby/sys/symlink v0.2.0 ## explicit; go 1.16 github.com/moby/sys/symlink -# github.com/moby/sys/user v0.1.0 -## explicit; go 1.17 +# github.com/moby/sys/user v0.2.0 +## explicit; go 1.21 github.com/moby/sys/user # github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd ## explicit From 65f7d07409562252aaab84da481ca4e9334a5810 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 16 Jul 2024 21:50:24 +0200 Subject: [PATCH 2/3] pkg/userns: deprecate and migrate to github.com/moby/sys/user/userns The userns package in libcontainer was integrated into the moby/sys/user module at commit [3778ae603c706494fd1e2c2faf83b406e38d687d][1]. This patch deprecates the containerd fork of that package, and adds it as an alias for the moby/sys/user/userns package. [1]: https://github.com/opencontainers/runc/commit/3778ae603c706494fd1e2c2faf83b406e38d687d Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 8437c567d89bae1154c4ff926bf96bac39b8f30f) Signed-off-by: Sebastiaan van Stijn --- archive/tar.go | 3 +- archive/tar_unix.go | 5 +- diff/apply/apply_linux.go | 6 +- mount/mount_linux.go | 2 +- oci/utils_unix.go | 2 +- oci/utils_unix_test.go | 3 +- .../sbserver/podsandbox/sandbox_run_linux.go | 2 +- pkg/cri/sbserver/service_linux.go | 2 +- pkg/cri/server/sandbox_run_linux.go | 2 +- pkg/cri/server/service_linux.go | 2 +- ...ns_unsupported.go => userns_deprecated.go} | 14 +++-- pkg/userns/userns_linux.go | 62 ------------------- runtime/v2/runc/task/service.go | 3 +- snapshots/overlay/overlayutils/check.go | 3 +- sys/oom_linux.go | 2 +- sys/oom_linux_test.go | 2 +- .../github.com/moby/sys/user/userns/userns.go | 16 +++++ .../moby/sys/user/userns/userns_linux.go | 53 ++++++++++++++++ .../sys/user/userns/userns_linux_fuzzer.go | 8 +++ .../sys/user/userns/userns_unsupported.go | 6 ++ vendor/modules.txt | 1 + 21 files changed, 114 insertions(+), 85 deletions(-) rename pkg/userns/{userns_unsupported.go => userns_deprecated.go} (66%) delete mode 100644 pkg/userns/userns_linux.go create mode 100644 vendor/github.com/moby/sys/user/userns/userns.go create mode 100644 vendor/github.com/moby/sys/user/userns/userns_linux.go create mode 100644 vendor/github.com/moby/sys/user/userns/userns_linux_fuzzer.go create mode 100644 vendor/github.com/moby/sys/user/userns/userns_unsupported.go diff --git a/archive/tar.go b/archive/tar.go index cdc7e14bfd..aadb694f8d 100644 --- a/archive/tar.go +++ b/archive/tar.go @@ -29,9 +29,10 @@ import ( "syscall" "time" + "github.com/moby/sys/user/userns" + "github.com/containerd/containerd/archive/tarheader" "github.com/containerd/containerd/pkg/epoch" - "github.com/containerd/containerd/pkg/userns" "github.com/containerd/continuity/fs" "github.com/containerd/log" ) diff --git a/archive/tar_unix.go b/archive/tar_unix.go index 8e883eee62..866a368242 100644 --- a/archive/tar_unix.go +++ b/archive/tar_unix.go @@ -27,10 +27,11 @@ import ( "strings" "syscall" - "github.com/containerd/containerd/pkg/userns" + "github.com/moby/sys/user/userns" + "golang.org/x/sys/unix" + "github.com/containerd/continuity/fs" "github.com/containerd/continuity/sysx" - "golang.org/x/sys/unix" ) func chmodTarEntry(perm os.FileMode) os.FileMode { diff --git a/diff/apply/apply_linux.go b/diff/apply/apply_linux.go index ee30a1d1c7..3d93f38451 100644 --- a/diff/apply/apply_linux.go +++ b/diff/apply/apply_linux.go @@ -23,12 +23,12 @@ import ( "os" "strings" + "github.com/moby/sys/user/userns" + "golang.org/x/sys/unix" + "github.com/containerd/containerd/archive" "github.com/containerd/containerd/mount" - "github.com/containerd/containerd/pkg/userns" "github.com/containerd/errdefs" - - "golang.org/x/sys/unix" ) func apply(ctx context.Context, mounts []mount.Mount, r io.Reader, sync bool) (retErr error) { diff --git a/mount/mount_linux.go b/mount/mount_linux.go index 34aa639bb6..6c353e9a2a 100644 --- a/mount/mount_linux.go +++ b/mount/mount_linux.go @@ -26,7 +26,7 @@ import ( "strings" "time" - "github.com/containerd/containerd/pkg/userns" + "github.com/moby/sys/user/userns" "golang.org/x/sys/unix" ) diff --git a/oci/utils_unix.go b/oci/utils_unix.go index b3cb8a600d..f954df7976 100644 --- a/oci/utils_unix.go +++ b/oci/utils_unix.go @@ -24,7 +24,7 @@ import ( "os" "path/filepath" - "github.com/containerd/containerd/pkg/userns" + "github.com/moby/sys/user/userns" specs "github.com/opencontainers/runtime-spec/specs-go" "golang.org/x/sys/unix" ) diff --git a/oci/utils_unix_test.go b/oci/utils_unix_test.go index 18d4e944ec..da4838b391 100644 --- a/oci/utils_unix_test.go +++ b/oci/utils_unix_test.go @@ -25,9 +25,8 @@ import ( "runtime" "testing" + "github.com/moby/sys/user/userns" "github.com/stretchr/testify/assert" - - "github.com/containerd/containerd/pkg/userns" ) func cleanupTest() { diff --git a/pkg/cri/sbserver/podsandbox/sandbox_run_linux.go b/pkg/cri/sbserver/podsandbox/sandbox_run_linux.go index 9b3077208c..a1a26d63e3 100644 --- a/pkg/cri/sbserver/podsandbox/sandbox_run_linux.go +++ b/pkg/cri/sbserver/podsandbox/sandbox_run_linux.go @@ -25,6 +25,7 @@ import ( "github.com/containerd/containerd" "github.com/containerd/containerd/oci" "github.com/containerd/containerd/plugin" + "github.com/moby/sys/user/userns" imagespec "github.com/opencontainers/image-spec/specs-go/v1" runtimespec "github.com/opencontainers/runtime-spec/specs-go" "github.com/opencontainers/selinux/go-selinux" @@ -33,7 +34,6 @@ import ( "github.com/containerd/containerd/pkg/cri/annotations" customopts "github.com/containerd/containerd/pkg/cri/opts" - "github.com/containerd/containerd/pkg/userns" ) func (c *Controller) sandboxContainerSpec(id string, config *runtime.PodSandboxConfig, diff --git a/pkg/cri/sbserver/service_linux.go b/pkg/cri/sbserver/service_linux.go index 205d46814c..a094b28228 100644 --- a/pkg/cri/sbserver/service_linux.go +++ b/pkg/cri/sbserver/service_linux.go @@ -20,8 +20,8 @@ import ( "fmt" "github.com/containerd/containerd/pkg/cap" - "github.com/containerd/containerd/pkg/userns" "github.com/containerd/go-cni" + "github.com/moby/sys/user/userns" "github.com/opencontainers/selinux/go-selinux" "github.com/sirupsen/logrus" "tags.cncf.io/container-device-interface/pkg/cdi" diff --git a/pkg/cri/server/sandbox_run_linux.go b/pkg/cri/server/sandbox_run_linux.go index 6c24017e6c..24fcb0e2b1 100644 --- a/pkg/cri/server/sandbox_run_linux.go +++ b/pkg/cri/server/sandbox_run_linux.go @@ -26,6 +26,7 @@ import ( "github.com/containerd/containerd/oci" "github.com/containerd/containerd/plugin" "github.com/containerd/containerd/snapshots" + "github.com/moby/sys/user/userns" imagespec "github.com/opencontainers/image-spec/specs-go/v1" runtimespec "github.com/opencontainers/runtime-spec/specs-go" selinux "github.com/opencontainers/selinux/go-selinux" @@ -34,7 +35,6 @@ import ( "github.com/containerd/containerd/pkg/cri/annotations" customopts "github.com/containerd/containerd/pkg/cri/opts" - "github.com/containerd/containerd/pkg/userns" ) func (c *criService) sandboxContainerSpec(id string, config *runtime.PodSandboxConfig, diff --git a/pkg/cri/server/service_linux.go b/pkg/cri/server/service_linux.go index 7d3dd6733b..3a51d81d10 100644 --- a/pkg/cri/server/service_linux.go +++ b/pkg/cri/server/service_linux.go @@ -20,8 +20,8 @@ import ( "fmt" "github.com/containerd/containerd/pkg/cap" - "github.com/containerd/containerd/pkg/userns" cni "github.com/containerd/go-cni" + "github.com/moby/sys/user/userns" "github.com/opencontainers/selinux/go-selinux" "github.com/sirupsen/logrus" "tags.cncf.io/container-device-interface/pkg/cdi" diff --git a/pkg/userns/userns_unsupported.go b/pkg/userns/userns_deprecated.go similarity index 66% rename from pkg/userns/userns_unsupported.go rename to pkg/userns/userns_deprecated.go index c67f773d0a..e1edbc44bf 100644 --- a/pkg/userns/userns_unsupported.go +++ b/pkg/userns/userns_deprecated.go @@ -1,5 +1,3 @@ -//go:build !linux - /* Copyright The containerd Authors. @@ -16,10 +14,16 @@ limitations under the License. */ +// Deprecated: use github.com/moby/sys/user/userns package userns -// RunningInUserNS is a stub for non-Linux systems -// Always returns false +import "github.com/moby/sys/user/userns" + +// RunningInUserNS detects whether we are currently running in a Linux +// user namespace and memoizes the result. It returns false on non-Linux +// platforms. +// +// Deprecated: use [userns.RunningInUserNS]. func RunningInUserNS() bool { - return false + return userns.RunningInUserNS() } diff --git a/pkg/userns/userns_linux.go b/pkg/userns/userns_linux.go deleted file mode 100644 index 6656465efb..0000000000 --- a/pkg/userns/userns_linux.go +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright The containerd Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package userns - -import ( - "bufio" - "fmt" - "os" - "sync" -) - -var ( - inUserNS bool - nsOnce sync.Once -) - -// RunningInUserNS detects whether we are currently running in a user namespace. -// Originally copied from github.com/lxc/lxd/shared/util.go -func RunningInUserNS() bool { - nsOnce.Do(func() { - file, err := os.Open("/proc/self/uid_map") - if err != nil { - // This kernel-provided file only exists if user namespaces are supported - return - } - defer file.Close() - - buf := bufio.NewReader(file) - l, _, err := buf.ReadLine() - if err != nil { - return - } - - line := string(l) - var a, b, c int64 - fmt.Sscanf(line, "%d %d %d", &a, &b, &c) - - /* - * We assume we are in the initial user namespace if we have a full - * range - 4294967295 uids starting at uid 0. - */ - if a == 0 && b == 0 && c == 4294967295 { - return - } - inUserNS = true - }) - return inUserNS -} diff --git a/runtime/v2/runc/task/service.go b/runtime/v2/runc/task/service.go index 1395c37697..05557e7482 100644 --- a/runtime/v2/runc/task/service.go +++ b/runtime/v2/runc/task/service.go @@ -24,6 +24,8 @@ import ( "os" "sync" + "github.com/moby/sys/user/userns" + "github.com/containerd/cgroups/v3" "github.com/containerd/cgroups/v3/cgroup1" cgroupsv2 "github.com/containerd/cgroups/v3/cgroup2" @@ -37,7 +39,6 @@ import ( "github.com/containerd/containerd/pkg/process" "github.com/containerd/containerd/pkg/shutdown" "github.com/containerd/containerd/pkg/stdio" - "github.com/containerd/containerd/pkg/userns" "github.com/containerd/containerd/protobuf" ptypes "github.com/containerd/containerd/protobuf/types" "github.com/containerd/containerd/runtime/v2/runc" diff --git a/snapshots/overlay/overlayutils/check.go b/snapshots/overlay/overlayutils/check.go index 313947b077..a6e876fa6e 100644 --- a/snapshots/overlay/overlayutils/check.go +++ b/snapshots/overlay/overlayutils/check.go @@ -24,9 +24,10 @@ import ( "path/filepath" "syscall" + "github.com/moby/sys/user/userns" + kernel "github.com/containerd/containerd/contrib/seccomp/kernelversion" "github.com/containerd/containerd/mount" - "github.com/containerd/containerd/pkg/userns" "github.com/containerd/continuity/fs" "github.com/containerd/log" ) diff --git a/sys/oom_linux.go b/sys/oom_linux.go index bb2a3eafb4..5894544d4d 100644 --- a/sys/oom_linux.go +++ b/sys/oom_linux.go @@ -22,7 +22,7 @@ import ( "strconv" "strings" - "github.com/containerd/containerd/pkg/userns" + "github.com/moby/sys/user/userns" "golang.org/x/sys/unix" ) diff --git a/sys/oom_linux_test.go b/sys/oom_linux_test.go index cb22870955..da9cf912a8 100644 --- a/sys/oom_linux_test.go +++ b/sys/oom_linux_test.go @@ -24,7 +24,7 @@ import ( "testing" "time" - "github.com/containerd/containerd/pkg/userns" + "github.com/moby/sys/user/userns" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/vendor/github.com/moby/sys/user/userns/userns.go b/vendor/github.com/moby/sys/user/userns/userns.go new file mode 100644 index 0000000000..56b24c44ad --- /dev/null +++ b/vendor/github.com/moby/sys/user/userns/userns.go @@ -0,0 +1,16 @@ +// Package userns provides utilities to detect whether we are currently running +// in a Linux user namespace. +// +// This code was migrated from [libcontainer/runc], which based its implementation +// on code from [lcx/incus]. +// +// [libcontainer/runc]: https://github.com/opencontainers/runc/blob/3778ae603c706494fd1e2c2faf83b406e38d687d/libcontainer/userns/userns_linux.go#L12-L49 +// [lcx/incus]: https://github.com/lxc/incus/blob/e45085dd42f826b3c8c3228e9733c0b6f998eafe/shared/util.go#L678-L700 +package userns + +// RunningInUserNS detects whether we are currently running in a Linux +// user namespace and memoizes the result. It returns false on non-Linux +// platforms. +func RunningInUserNS() bool { + return inUserNS() +} diff --git a/vendor/github.com/moby/sys/user/userns/userns_linux.go b/vendor/github.com/moby/sys/user/userns/userns_linux.go new file mode 100644 index 0000000000..87c1c38eec --- /dev/null +++ b/vendor/github.com/moby/sys/user/userns/userns_linux.go @@ -0,0 +1,53 @@ +package userns + +import ( + "bufio" + "fmt" + "os" + "sync" +) + +var inUserNS = sync.OnceValue(runningInUserNS) + +// runningInUserNS detects whether we are currently running in a user namespace. +// +// This code was migrated from [libcontainer/runc] and based on an implementation +// from [lcx/incus]. +// +// [libcontainer/runc]: https://github.com/opencontainers/runc/blob/3778ae603c706494fd1e2c2faf83b406e38d687d/libcontainer/userns/userns_linux.go#L12-L49 +// [lcx/incus]: https://github.com/lxc/incus/blob/e45085dd42f826b3c8c3228e9733c0b6f998eafe/shared/util.go#L678-L700 +func runningInUserNS() bool { + file, err := os.Open("/proc/self/uid_map") + if err != nil { + // This kernel-provided file only exists if user namespaces are supported. + return false + } + defer file.Close() + + buf := bufio.NewReader(file) + l, _, err := buf.ReadLine() + if err != nil { + return false + } + + return uidMapInUserNS(string(l)) +} + +func uidMapInUserNS(uidMap string) bool { + if uidMap == "" { + // File exist but empty (the initial state when userns is created, + // see user_namespaces(7)). + return true + } + + var a, b, c int64 + if _, err := fmt.Sscanf(uidMap, "%d %d %d", &a, &b, &c); err != nil { + // Assume we are in a regular, non user namespace. + return false + } + + // As per user_namespaces(7), /proc/self/uid_map of + // the initial user namespace shows 0 0 4294967295. + initNS := a == 0 && b == 0 && c == 4294967295 + return !initNS +} diff --git a/vendor/github.com/moby/sys/user/userns/userns_linux_fuzzer.go b/vendor/github.com/moby/sys/user/userns/userns_linux_fuzzer.go new file mode 100644 index 0000000000..26ba2e16ec --- /dev/null +++ b/vendor/github.com/moby/sys/user/userns/userns_linux_fuzzer.go @@ -0,0 +1,8 @@ +//go:build linux && gofuzz + +package userns + +func FuzzUIDMap(uidmap []byte) int { + _ = uidMapInUserNS(string(uidmap)) + return 1 +} diff --git a/vendor/github.com/moby/sys/user/userns/userns_unsupported.go b/vendor/github.com/moby/sys/user/userns/userns_unsupported.go new file mode 100644 index 0000000000..8ed83072c2 --- /dev/null +++ b/vendor/github.com/moby/sys/user/userns/userns_unsupported.go @@ -0,0 +1,6 @@ +//go:build !linux + +package userns + +// inUserNS is a stub for non-Linux systems. Always returns false. +func inUserNS() bool { return false } diff --git a/vendor/modules.txt b/vendor/modules.txt index 2a0cae9d33..1ccd59f369 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -369,6 +369,7 @@ github.com/moby/sys/symlink # github.com/moby/sys/user v0.2.0 ## explicit; go 1.21 github.com/moby/sys/user +github.com/moby/sys/user/userns # github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd ## explicit github.com/modern-go/concurrent From dce0b5a6d338900f33ff44808483ebf63dced65a Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 8 Aug 2024 12:48:54 +0200 Subject: [PATCH 3/3] migrate to github.com/moby/sys/userns Commit 8437c567d89bae1154c4ff926bf96bac39b8f30f migrated the use of the userns package to the github.com/moby/sys/user module. After further discussion with maintainers, it was decided to move the userns package to a separate module, as it has no direct relation with "user" operations (other than having "user" in its name). This patch migrates our code to use the new module. Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 977604724340e6ed410c077fa2df5301ae1f30fe) Signed-off-by: Sebastiaan van Stijn --- archive/tar.go | 2 +- archive/tar_unix.go | 2 +- diff/apply/apply_linux.go | 2 +- go.mod | 3 +- go.sum | 6 +- integration/client/go.mod | 3 +- integration/client/go.sum | 6 +- mount/mount_linux.go | 2 +- oci/utils_unix.go | 2 +- oci/utils_unix_test.go | 2 +- .../sbserver/podsandbox/sandbox_run_linux.go | 2 +- pkg/cri/sbserver/service_linux.go | 2 +- pkg/cri/server/sandbox_run_linux.go | 2 +- pkg/cri/server/service_linux.go | 2 +- pkg/userns/userns_deprecated.go | 4 +- runtime/v2/runc/task/service.go | 2 +- snapshots/overlay/overlayutils/check.go | 2 +- sys/oom_linux.go | 2 +- sys/oom_linux_test.go | 2 +- vendor/github.com/moby/sys/userns/LICENSE | 202 ++++++++++++++++++ .../moby/sys/{user => }/userns/userns.go | 0 .../sys/{user => }/userns/userns_linux.go | 0 .../{user => }/userns/userns_linux_fuzzer.go | 0 .../{user => }/userns/userns_unsupported.go | 0 vendor/modules.txt | 8 +- 25 files changed, 235 insertions(+), 25 deletions(-) create mode 100644 vendor/github.com/moby/sys/userns/LICENSE rename vendor/github.com/moby/sys/{user => }/userns/userns.go (100%) rename vendor/github.com/moby/sys/{user => }/userns/userns_linux.go (100%) rename vendor/github.com/moby/sys/{user => }/userns/userns_linux_fuzzer.go (100%) rename vendor/github.com/moby/sys/{user => }/userns/userns_unsupported.go (100%) diff --git a/archive/tar.go b/archive/tar.go index aadb694f8d..c61f89ec8d 100644 --- a/archive/tar.go +++ b/archive/tar.go @@ -29,7 +29,7 @@ import ( "syscall" "time" - "github.com/moby/sys/user/userns" + "github.com/moby/sys/userns" "github.com/containerd/containerd/archive/tarheader" "github.com/containerd/containerd/pkg/epoch" diff --git a/archive/tar_unix.go b/archive/tar_unix.go index 866a368242..fa61100609 100644 --- a/archive/tar_unix.go +++ b/archive/tar_unix.go @@ -27,7 +27,7 @@ import ( "strings" "syscall" - "github.com/moby/sys/user/userns" + "github.com/moby/sys/userns" "golang.org/x/sys/unix" "github.com/containerd/continuity/fs" diff --git a/diff/apply/apply_linux.go b/diff/apply/apply_linux.go index 3d93f38451..99f3278de9 100644 --- a/diff/apply/apply_linux.go +++ b/diff/apply/apply_linux.go @@ -23,7 +23,7 @@ import ( "os" "strings" - "github.com/moby/sys/user/userns" + "github.com/moby/sys/userns" "golang.org/x/sys/unix" "github.com/containerd/containerd/archive" diff --git a/go.mod b/go.mod index 084a39fbf8..0b92b6d2a3 100644 --- a/go.mod +++ b/go.mod @@ -48,7 +48,8 @@ require ( github.com/moby/sys/sequential v0.5.0 github.com/moby/sys/signal v0.7.0 github.com/moby/sys/symlink v0.2.0 - github.com/moby/sys/user v0.2.0 + github.com/moby/sys/user v0.3.0 + github.com/moby/sys/userns v0.1.0 github.com/opencontainers/go-digest v1.0.0 github.com/opencontainers/image-spec v1.1.0 github.com/opencontainers/runtime-spec v1.1.0 diff --git a/go.sum b/go.sum index 632a8ed7f5..044d37b418 100644 --- a/go.sum +++ b/go.sum @@ -545,8 +545,10 @@ github.com/moby/sys/signal v0.7.0/go.mod h1:GQ6ObYZfqacOwTtlXvcmh9A26dVRul/hbOZn github.com/moby/sys/symlink v0.1.0/go.mod h1:GGDODQmbFOjFsXvfLVn3+ZRxkch54RkSiGqsZeMYowQ= github.com/moby/sys/symlink v0.2.0 h1:tk1rOM+Ljp0nFmfOIBtlV3rTDlWOwFRhjEeAhZB0nZc= github.com/moby/sys/symlink v0.2.0/go.mod h1:7uZVF2dqJjG/NsClqul95CqKOBRQyYSNnJ6BMgR/gFs= -github.com/moby/sys/user v0.2.0 h1:OnpapJsRp25vkhw8TFG6OLJODNh/3rEwRWtJ3kakwRM= -github.com/moby/sys/user v0.2.0/go.mod h1:RYstrcWOJpVh+6qzUqp2bU3eaRpdiQeKGlKitaH0PM8= +github.com/moby/sys/user v0.3.0 h1:9ni5DlcW5an3SvRSx4MouotOygvzaXbaSrc/wGDFWPo= +github.com/moby/sys/user v0.3.0/go.mod h1:bG+tYYYJgaMtRKgEmuueC0hJEAZWwtIbZTB+85uoHjs= +github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g= +github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= github.com/moby/term v0.0.0-20200312100748-672ec06f55cd/go.mod h1:DdlQx2hp0Ss5/fLikoLlEeIYiATotOjgB//nb973jeo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= diff --git a/integration/client/go.mod b/integration/client/go.mod index 5d4c14442a..691214ef69 100644 --- a/integration/client/go.mod +++ b/integration/client/go.mod @@ -52,7 +52,8 @@ require ( github.com/moby/sys/mountinfo v0.6.2 // indirect github.com/moby/sys/sequential v0.5.0 // indirect github.com/moby/sys/signal v0.7.0 // indirect - github.com/moby/sys/user v0.2.0 // indirect + github.com/moby/sys/user v0.3.0 // indirect + github.com/moby/sys/userns v0.1.0 // indirect github.com/opencontainers/selinux v1.11.0 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pkg/errors v0.9.1 // indirect diff --git a/integration/client/go.sum b/integration/client/go.sum index 79af20d5b8..3da1496212 100644 --- a/integration/client/go.sum +++ b/integration/client/go.sum @@ -1820,8 +1820,10 @@ github.com/moby/sys/signal v0.6.0/go.mod h1:GQ6ObYZfqacOwTtlXvcmh9A26dVRul/hbOZn github.com/moby/sys/signal v0.7.0 h1:25RW3d5TnQEoKvRbEKUGay6DCQ46IxAVTT9CUMgmsSI= github.com/moby/sys/signal v0.7.0/go.mod h1:GQ6ObYZfqacOwTtlXvcmh9A26dVRul/hbOZn88Kg8Tg= github.com/moby/sys/symlink v0.2.0/go.mod h1:7uZVF2dqJjG/NsClqul95CqKOBRQyYSNnJ6BMgR/gFs= -github.com/moby/sys/user v0.2.0 h1:OnpapJsRp25vkhw8TFG6OLJODNh/3rEwRWtJ3kakwRM= -github.com/moby/sys/user v0.2.0/go.mod h1:RYstrcWOJpVh+6qzUqp2bU3eaRpdiQeKGlKitaH0PM8= +github.com/moby/sys/user v0.3.0 h1:9ni5DlcW5an3SvRSx4MouotOygvzaXbaSrc/wGDFWPo= +github.com/moby/sys/user v0.3.0/go.mod h1:bG+tYYYJgaMtRKgEmuueC0hJEAZWwtIbZTB+85uoHjs= +github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g= +github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= github.com/moby/term v0.0.0-20210610120745-9d4ed1856297/go.mod h1:vgPCkQMyxTZ7IDy8SXRufE172gr8+K/JE/7hHFxHW3A= github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= diff --git a/mount/mount_linux.go b/mount/mount_linux.go index 6c353e9a2a..402def9c79 100644 --- a/mount/mount_linux.go +++ b/mount/mount_linux.go @@ -26,7 +26,7 @@ import ( "strings" "time" - "github.com/moby/sys/user/userns" + "github.com/moby/sys/userns" "golang.org/x/sys/unix" ) diff --git a/oci/utils_unix.go b/oci/utils_unix.go index f954df7976..602bbed148 100644 --- a/oci/utils_unix.go +++ b/oci/utils_unix.go @@ -24,7 +24,7 @@ import ( "os" "path/filepath" - "github.com/moby/sys/user/userns" + "github.com/moby/sys/userns" specs "github.com/opencontainers/runtime-spec/specs-go" "golang.org/x/sys/unix" ) diff --git a/oci/utils_unix_test.go b/oci/utils_unix_test.go index da4838b391..9c19205d69 100644 --- a/oci/utils_unix_test.go +++ b/oci/utils_unix_test.go @@ -25,7 +25,7 @@ import ( "runtime" "testing" - "github.com/moby/sys/user/userns" + "github.com/moby/sys/userns" "github.com/stretchr/testify/assert" ) diff --git a/pkg/cri/sbserver/podsandbox/sandbox_run_linux.go b/pkg/cri/sbserver/podsandbox/sandbox_run_linux.go index a1a26d63e3..3b899a8de3 100644 --- a/pkg/cri/sbserver/podsandbox/sandbox_run_linux.go +++ b/pkg/cri/sbserver/podsandbox/sandbox_run_linux.go @@ -25,7 +25,7 @@ import ( "github.com/containerd/containerd" "github.com/containerd/containerd/oci" "github.com/containerd/containerd/plugin" - "github.com/moby/sys/user/userns" + "github.com/moby/sys/userns" imagespec "github.com/opencontainers/image-spec/specs-go/v1" runtimespec "github.com/opencontainers/runtime-spec/specs-go" "github.com/opencontainers/selinux/go-selinux" diff --git a/pkg/cri/sbserver/service_linux.go b/pkg/cri/sbserver/service_linux.go index a094b28228..8b3cf866fa 100644 --- a/pkg/cri/sbserver/service_linux.go +++ b/pkg/cri/sbserver/service_linux.go @@ -21,7 +21,7 @@ import ( "github.com/containerd/containerd/pkg/cap" "github.com/containerd/go-cni" - "github.com/moby/sys/user/userns" + "github.com/moby/sys/userns" "github.com/opencontainers/selinux/go-selinux" "github.com/sirupsen/logrus" "tags.cncf.io/container-device-interface/pkg/cdi" diff --git a/pkg/cri/server/sandbox_run_linux.go b/pkg/cri/server/sandbox_run_linux.go index 24fcb0e2b1..cba1dadcbd 100644 --- a/pkg/cri/server/sandbox_run_linux.go +++ b/pkg/cri/server/sandbox_run_linux.go @@ -26,7 +26,7 @@ import ( "github.com/containerd/containerd/oci" "github.com/containerd/containerd/plugin" "github.com/containerd/containerd/snapshots" - "github.com/moby/sys/user/userns" + "github.com/moby/sys/userns" imagespec "github.com/opencontainers/image-spec/specs-go/v1" runtimespec "github.com/opencontainers/runtime-spec/specs-go" selinux "github.com/opencontainers/selinux/go-selinux" diff --git a/pkg/cri/server/service_linux.go b/pkg/cri/server/service_linux.go index 3a51d81d10..851f51a140 100644 --- a/pkg/cri/server/service_linux.go +++ b/pkg/cri/server/service_linux.go @@ -21,7 +21,7 @@ import ( "github.com/containerd/containerd/pkg/cap" cni "github.com/containerd/go-cni" - "github.com/moby/sys/user/userns" + "github.com/moby/sys/userns" "github.com/opencontainers/selinux/go-selinux" "github.com/sirupsen/logrus" "tags.cncf.io/container-device-interface/pkg/cdi" diff --git a/pkg/userns/userns_deprecated.go b/pkg/userns/userns_deprecated.go index e1edbc44bf..79d22a5d1d 100644 --- a/pkg/userns/userns_deprecated.go +++ b/pkg/userns/userns_deprecated.go @@ -14,10 +14,10 @@ limitations under the License. */ -// Deprecated: use github.com/moby/sys/user/userns +// Deprecated: use github.com/moby/sys/userns package userns -import "github.com/moby/sys/user/userns" +import "github.com/moby/sys/userns" // RunningInUserNS detects whether we are currently running in a Linux // user namespace and memoizes the result. It returns false on non-Linux diff --git a/runtime/v2/runc/task/service.go b/runtime/v2/runc/task/service.go index 05557e7482..132a5cbb3e 100644 --- a/runtime/v2/runc/task/service.go +++ b/runtime/v2/runc/task/service.go @@ -24,7 +24,7 @@ import ( "os" "sync" - "github.com/moby/sys/user/userns" + "github.com/moby/sys/userns" "github.com/containerd/cgroups/v3" "github.com/containerd/cgroups/v3/cgroup1" diff --git a/snapshots/overlay/overlayutils/check.go b/snapshots/overlay/overlayutils/check.go index a6e876fa6e..23a39e016d 100644 --- a/snapshots/overlay/overlayutils/check.go +++ b/snapshots/overlay/overlayutils/check.go @@ -24,7 +24,7 @@ import ( "path/filepath" "syscall" - "github.com/moby/sys/user/userns" + "github.com/moby/sys/userns" kernel "github.com/containerd/containerd/contrib/seccomp/kernelversion" "github.com/containerd/containerd/mount" diff --git a/sys/oom_linux.go b/sys/oom_linux.go index 5894544d4d..01ebbebb59 100644 --- a/sys/oom_linux.go +++ b/sys/oom_linux.go @@ -22,7 +22,7 @@ import ( "strconv" "strings" - "github.com/moby/sys/user/userns" + "github.com/moby/sys/userns" "golang.org/x/sys/unix" ) diff --git a/sys/oom_linux_test.go b/sys/oom_linux_test.go index da9cf912a8..9266f65a91 100644 --- a/sys/oom_linux_test.go +++ b/sys/oom_linux_test.go @@ -24,7 +24,7 @@ import ( "testing" "time" - "github.com/moby/sys/user/userns" + "github.com/moby/sys/userns" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/vendor/github.com/moby/sys/userns/LICENSE b/vendor/github.com/moby/sys/userns/LICENSE new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/vendor/github.com/moby/sys/userns/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/moby/sys/user/userns/userns.go b/vendor/github.com/moby/sys/userns/userns.go similarity index 100% rename from vendor/github.com/moby/sys/user/userns/userns.go rename to vendor/github.com/moby/sys/userns/userns.go diff --git a/vendor/github.com/moby/sys/user/userns/userns_linux.go b/vendor/github.com/moby/sys/userns/userns_linux.go similarity index 100% rename from vendor/github.com/moby/sys/user/userns/userns_linux.go rename to vendor/github.com/moby/sys/userns/userns_linux.go diff --git a/vendor/github.com/moby/sys/user/userns/userns_linux_fuzzer.go b/vendor/github.com/moby/sys/userns/userns_linux_fuzzer.go similarity index 100% rename from vendor/github.com/moby/sys/user/userns/userns_linux_fuzzer.go rename to vendor/github.com/moby/sys/userns/userns_linux_fuzzer.go diff --git a/vendor/github.com/moby/sys/user/userns/userns_unsupported.go b/vendor/github.com/moby/sys/userns/userns_unsupported.go similarity index 100% rename from vendor/github.com/moby/sys/user/userns/userns_unsupported.go rename to vendor/github.com/moby/sys/userns/userns_unsupported.go diff --git a/vendor/modules.txt b/vendor/modules.txt index 1ccd59f369..61d5ec0205 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -366,10 +366,12 @@ github.com/moby/sys/signal # github.com/moby/sys/symlink v0.2.0 ## explicit; go 1.16 github.com/moby/sys/symlink -# github.com/moby/sys/user v0.2.0 -## explicit; go 1.21 +# github.com/moby/sys/user v0.3.0 +## explicit; go 1.17 github.com/moby/sys/user -github.com/moby/sys/user/userns +# github.com/moby/sys/userns v0.1.0 +## explicit; go 1.21 +github.com/moby/sys/userns # github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd ## explicit github.com/modern-go/concurrent