Skip to content

Commit 6579529

Browse files
committed
WIP: NewPid2
Take advantage of [1] to avoid crashing with: container_linux.go:348: starting container process caused "open /proc/9976/status: no such file or directory" [1]: syndtr/gocapability#14 Signed-off-by: W. Trevor King <[email protected]>
1 parent 0cd9a7e commit 6579529

File tree

4 files changed

+72
-15
lines changed

4 files changed

+72
-15
lines changed

libcontainer/capabilities_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func newContainerCapList(capConfig *configs.Capabilities) (*containerCapabilitie
7171
}
7272
ambient = append(ambient, v)
7373
}
74-
pid, err := capability.NewPid(0)
74+
pid, err := capability.NewPid2(0)
7575
if err != nil {
7676
return nil, err
7777
}

libcontainer/container_linux.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1804,10 +1804,14 @@ func (c *linuxContainer) bootstrapData(cloneFlags uintptr, nsMaps map[configs.Na
18041804
// The following only applies if we are root.
18051805
if !c.config.Rootless {
18061806
// check if we have CAP_SETGID to setgroup properly
1807-
pid, err := capability.NewPid(0)
1807+
pid, err := capability.NewPid2(0)
18081808
if err != nil {
18091809
return nil, err
18101810
}
1811+
err = pid.Load()
1812+
if err != nil && !os.IsNotExist(err) {
1813+
return nil, err
1814+
}
18111815
if !pid.Get(capability.EFFECTIVE, capability.CAP_SETGID) {
18121816
r.AddData(&Boolmsg{
18131817
Type: SetgroupAttr,

vendor/github.com/syndtr/gocapability/capability/capability.go

Lines changed: 66 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/syndtr/gocapability/capability/capability_linux.go

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)