diff --git a/src/runtime/go.mod b/src/runtime/go.mod index 42f998e00877..f1b56cafe6c4 100644 --- a/src/runtime/go.mod +++ b/src/runtime/go.mod @@ -75,7 +75,7 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cilium/ebpf v0.16.0 // indirect - github.com/containerd/cgroups/v3 v3.0.2 // indirect + github.com/containerd/cgroups/v3 v3.0.5 // indirect github.com/containerd/continuity v0.4.4 // indirect github.com/containerd/errdefs v0.3.0 // indirect github.com/containerd/go-runc v1.1.0 // indirect diff --git a/src/runtime/go.sum b/src/runtime/go.sum index 3336f867848f..355ecd6cc57b 100644 --- a/src/runtime/go.sum +++ b/src/runtime/go.sum @@ -35,8 +35,8 @@ github.com/container-orchestrated-devices/container-device-interface v0.6.0 h1:a github.com/container-orchestrated-devices/container-device-interface v0.6.0/go.mod h1:OQlgtJtDrOxSQ1BWODC8OZK1tzi9W69wek+Jy17ndzo= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= -github.com/containerd/cgroups/v3 v3.0.2 h1:f5WFqIVSgo5IZmtTT3qVBo6TzI1ON6sycSBKkymb9L0= -github.com/containerd/cgroups/v3 v3.0.2/go.mod h1:JUgITrzdFqp42uI2ryGA+ge0ap/nxzYgkGmIcetmErE= +github.com/containerd/cgroups/v3 v3.0.5 h1:44na7Ud+VwyE7LIoJ8JTNQOa549a8543BmzaJHo6Bzo= +github.com/containerd/cgroups/v3 v3.0.5/go.mod h1:SA5DLYnXO8pTGYiAHXz94qvLQTKfVM5GEVisn4jpins= github.com/containerd/console v1.0.5 h1:R0ymNeydRqH2DmakFNdmjR2k0t7UPuiOV/N/27/qqsc= github.com/containerd/console v1.0.5/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= github.com/containerd/containerd v1.7.27 h1:yFyEyojddO3MIGVER2xJLWoCIn+Up4GaHFquP7hsFII= diff --git a/src/runtime/vendor/github.com/containerd/cgroups/v3/Makefile b/src/runtime/vendor/github.com/containerd/cgroups/v3/Makefile index 088572980dff..8f8b6bc5ace8 100644 --- a/src/runtime/vendor/github.com/containerd/cgroups/v3/Makefile +++ b/src/runtime/vendor/github.com/containerd/cgroups/v3/Makefile @@ -13,14 +13,17 @@ # limitations under the License. PACKAGES=$(shell go list ./... | grep -v /vendor/) +GO_TAGS=$(if $(GO_BUILDTAGS),-tags "$(strip $(GO_BUILDTAGS))",) +GO ?= go +GO_BUILD_FLAGS ?= all: cgutil - go build -v + $(GO) build -v $(GO_TAGS) cgutil: - cd cmd/cgctl && go build -v + cd cmd/cgctl && $(GO) build $(GO_BUILD_FLAGS) -v $(GO_TAGS) proto: protobuild --quiet ${PACKAGES} # Keep them Go-idiomatic and backward-compatible with the gogo/protobuf era. - go-fix-acronym -w -a '(Cpu|Tcp|Rss)' $(shell find cgroup1/stats/ cgroup2/stats/ -name '*.pb.go') + go-fix-acronym -w -a '(Cpu|Tcp|Rss|Psi)' $(shell find cgroup1/stats/ cgroup2/stats/ -name '*.pb.go') diff --git a/src/runtime/vendor/github.com/containerd/cgroups/v3/Protobuild.toml b/src/runtime/vendor/github.com/containerd/cgroups/v3/Protobuild.toml index cf94b1c1ab2a..d27d12b33c9c 100644 --- a/src/runtime/vendor/github.com/containerd/cgroups/v3/Protobuild.toml +++ b/src/runtime/vendor/github.com/containerd/cgroups/v3/Protobuild.toml @@ -13,7 +13,7 @@ generators = ["go"] # This is the default. after = ["/usr/local/include", "/usr/include"] -# Aggregrate the API descriptors to lock down API changes. +# Aggregate the API descriptors to lock down API changes. [[descriptors]] prefix = "github.com/containerd/cgroups/cgroup1/stats" target = "cgroup1/stats/metrics.pb.txt" diff --git a/src/runtime/vendor/github.com/containerd/cgroups/v3/utils.go b/src/runtime/vendor/github.com/containerd/cgroups/v3/utils.go index ebff755a7611..6b4d04fdff17 100644 --- a/src/runtime/vendor/github.com/containerd/cgroups/v3/utils.go +++ b/src/runtime/vendor/github.com/containerd/cgroups/v3/utils.go @@ -25,12 +25,11 @@ import ( "strings" "sync" + "github.com/moby/sys/userns" "golang.org/x/sys/unix" ) var ( - nsOnce sync.Once - inUserNS bool checkMode sync.Once cgMode CGMode ) @@ -77,35 +76,10 @@ func Mode() CGMode { // RunningInUserNS detects whether we are currently running in a user namespace. // Copied from github.com/lxc/lxd/shared/util.go +// +// Deprecated: use [userns.RunningInUserNS]. 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 + return userns.RunningInUserNS() } // ParseCgroupFileUnified returns legacy subsystem paths as the first value, diff --git a/src/runtime/vendor/modules.txt b/src/runtime/vendor/modules.txt index 31ff0f9e5617..db906cf8e61b 100644 --- a/src/runtime/vendor/modules.txt +++ b/src/runtime/vendor/modules.txt @@ -91,8 +91,8 @@ github.com/containerd/cgroups github.com/containerd/cgroups/stats/v1 github.com/containerd/cgroups/v2 github.com/containerd/cgroups/v2/stats -# github.com/containerd/cgroups/v3 v3.0.2 -## explicit; go 1.18 +# github.com/containerd/cgroups/v3 v3.0.5 +## explicit; go 1.22.0 github.com/containerd/cgroups/v3 github.com/containerd/cgroups/v3/cgroup1/stats # github.com/containerd/console v1.0.5