Merge pull request #564 from hallyn/2016-02-16/userns.devicecg

Do not set devices cgroup entries if in a user namespace
This commit is contained in:
Mrunal Patel 2016-02-17 09:25:24 +05:30
commit 2c489ce2d9
1 changed files with 5 additions and 0 deletions

View File

@ -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 {
@ -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 {