Skip to content

Commit

Permalink
Merge pull request opencontainers#564 from hallyn/2016-02-16/userns.d…
Browse files Browse the repository at this point in the history
…evicecg

Do not set devices cgroup entries if in a user namespace
  • Loading branch information
Mrunal Patel committed Feb 17, 2016
2 parents d854d8f + 655f8ea commit 2c489ce
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libcontainer/cgroups/fs/devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package fs
import (
"github.com/opencontainers/runc/libcontainer/cgroups"
"github.com/opencontainers/runc/libcontainer/configs"
"github.com/opencontainers/runc/libcontainer/system"
)

type DevicesGroup struct {
Expand All @@ -25,6 +26,10 @@ func (s *DevicesGroup) Apply(d *cgroupData) error {
}

func (s *DevicesGroup) Set(path string, cgroup *configs.Cgroup) error {
if system.RunningInUserNS() {
return nil
}

devices := cgroup.Resources.Devices
if len(devices) > 0 {
for _, dev := range devices {
Expand Down

0 comments on commit 2c489ce

Please sign in to comment.