File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 55 "encoding/json"
66 "errors"
77 "fmt"
8+ "io"
89 "net"
910 "os"
1011 "path/filepath"
@@ -21,6 +22,7 @@ import (
2122
2223 "github.com/opencontainers/cgroups"
2324 "github.com/opencontainers/runc/internal/linux"
25+ "github.com/opencontainers/runc/internal/pathrs"
2426 "github.com/opencontainers/runc/libcontainer/capabilities"
2527 "github.com/opencontainers/runc/libcontainer/configs"
2628 "github.com/opencontainers/runc/libcontainer/system"
@@ -470,7 +472,12 @@ func setupUser(config *initConfig) error {
470472 // We don't need to use /proc/thread-self here because setgroups is a
471473 // per-userns file and thus is global to all threads in a thread-group.
472474 // This lets us avoid having to do runtime.LockOSThread.
473- setgroups , err := os .ReadFile ("/proc/self/setgroups" )
475+ var setgroups []byte
476+ setgroupsFile , err := pathrs .ProcSelfOpen ("setgroups" , unix .O_RDONLY )
477+ if err == nil {
478+ setgroups , err = io .ReadAll (setgroupsFile )
479+ _ = setgroupsFile .Close ()
480+ }
474481 if err != nil && ! os .IsNotExist (err ) {
475482 return err
476483 }
You can’t perform that action at this time.
0 commit comments