mirror of
https://github.com/containerd/containerd.git
synced 2026-11-06 05:17:02 +00:00
build(deps): bump github.com/moby/sys/userns in the moby-sys group
Bumps the moby-sys group with 1 update: [github.com/moby/sys/userns](https://github.com/moby/sys). Updates `github.com/moby/sys/userns` from 0.1.0 to 0.2.0 - [Release notes](https://github.com/moby/sys/releases) - [Commits](https://github.com/moby/sys/compare/user/v0.1.0...user/v0.2.0) --- updated-dependencies: - dependency-name: github.com/moby/sys/userns dependency-version: 0.2.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: moby-sys ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
1 parent
aeb8f4e52a
commit
0880064dea
4 files changed
+22
-4
No files matched your search
@@ -51,7 +51,7 @@ require (
|
||||
github.com/moby/sys/signal v0.7.1
|
||||
github.com/moby/sys/symlink v0.3.0
|
||||
github.com/moby/sys/user v0.4.1
|
||||
github.com/moby/sys/userns v0.1.0
|
||||
github.com/moby/sys/userns v0.2.0
|
||||
github.com/opencontainers/go-digest v1.0.0
|
||||
github.com/opencontainers/image-spec v1.1.1
|
||||
github.com/opencontainers/runtime-spec v1.3.0
|
||||
|
||||
@@ -215,8 +215,8 @@ github.com/moby/sys/symlink v0.3.0 h1:GZX89mEZ9u53f97npBy4Rc3vJKj7JBDj/PN2I22GrN
|
||||
github.com/moby/sys/symlink v0.3.0/go.mod h1:3eNdhduHmYPcgsJtZXW1W4XUJdZGBIkttZ8xKqPUJq0=
|
||||
github.com/moby/sys/user v0.4.1 h1:RgjRlaDKi/Xmyrz4t8lyzXT6v2ooFeO/7xtchmhVWE0=
|
||||
github.com/moby/sys/user v0.4.1/go.mod h1:E9QsW5WRe1kUAf7kW8hXKwu1uhsZEAdPLYHYSDudF4Y=
|
||||
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/sys/userns v0.2.0 h1:nEtDtp7NCV/6dutSklNe8FrENPwFdc4mXnZqC/JWgXM=
|
||||
github.com/moby/sys/userns v0.2.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28=
|
||||
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=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
|
||||
+18
@@ -5,8 +5,12 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"sync"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// See PROC_USER_INIT_INO in https://github.com/torvalds/linux/blob/v7.1/include/uapi/linux/nsfs.h#L50.
|
||||
const procUserInitIno = 0xEFFFFFFD
|
||||
|
||||
var inUserNS = sync.OnceValue(runningInUserNS)
|
||||
|
||||
// runningInUserNS detects whether we are currently running in a user namespace.
|
||||
@@ -17,6 +21,20 @@ var inUserNS = sync.OnceValue(runningInUserNS)
|
||||
// [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 {
|
||||
var st syscall.Stat_t
|
||||
if err := syscall.Stat("/proc/self/ns/user", &st); err == nil {
|
||||
return st.Ino != procUserInitIno
|
||||
} else if !os.IsNotExist(err) {
|
||||
// As long as /proc/self/ns/user exists, we are on a modern kernel.
|
||||
// Other errors indicate an unexpected procfs state, where assuming the
|
||||
// init namespace would be unsafe.
|
||||
return false
|
||||
}
|
||||
|
||||
// Only fall back for older kernels that do not expose the user namespace
|
||||
// through procfs at /proc/self/ns/user.
|
||||
// TODO: Remove this fallback once Linux kernels older than 3.8 are no
|
||||
// longer supported.
|
||||
file, err := os.Open("/proc/self/uid_map")
|
||||
if err != nil {
|
||||
// This kernel-provided file only exists if user namespaces are supported.
|
||||
|
||||
Vendored
+1
-1
@@ -458,7 +458,7 @@ github.com/moby/sys/symlink
|
||||
# github.com/moby/sys/user v0.4.1
|
||||
## explicit; go 1.18
|
||||
github.com/moby/sys/user
|
||||
# github.com/moby/sys/userns v0.1.0
|
||||
# github.com/moby/sys/userns v0.2.0
|
||||
## explicit; go 1.21
|
||||
github.com/moby/sys/userns
|
||||
# github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
|
||||
|
||||
Reference in new issue
Block a user