diff --git a/daemon/execdriver/native/apparmor.go b/daemon/execdriver/native/apparmor.go index 30d49b37b3..3aaba98a34 100644 --- a/daemon/execdriver/native/apparmor.go +++ b/daemon/execdriver/native/apparmor.go @@ -40,14 +40,11 @@ profile {{.Name}} flags=(attach_disconnected,mediate_deleted) { file, umount, - deny @{PROC}/sys/fs/** wklx, - deny @{PROC}/fs/** wklx, + deny @{PROC}/{*,**^[0-9*],sys/kernel/shm*} wkx, deny @{PROC}/sysrq-trigger rwklx, deny @{PROC}/mem rwklx, deny @{PROC}/kmem rwklx, deny @{PROC}/kcore rwklx, - deny @{PROC}/sys/kernel/[^s][^h][^m]* wklx, - deny @{PROC}/sys/kernel/*/** wklx, deny mount, diff --git a/integration-cli/docker_cli_run_test.go b/integration-cli/docker_cli_run_test.go index 8ff64bba17..795a1a4897 100644 --- a/integration-cli/docker_cli_run_test.go +++ b/integration-cli/docker_cli_run_test.go @@ -2808,6 +2808,18 @@ func (s *DockerSuite) TestAppArmorTraceSelf(c *check.C) { } } +func (s *DockerSuite) TestAppArmorDeniesChmodProc(c *check.C) { + testRequires(c, SameHostDaemon, NativeExecDriver, Apparmor) + _, exitCode, _ := dockerCmdWithError("run", "busybox", "chmod", "744", "/proc/cpuinfo") + if exitCode == 0 { + // If our test failed, attempt to repair the host system... + _, exitCode, _ := dockerCmdWithError("run", "busybox", "chmod", "444", "/proc/cpuinfo") + if exitCode == 0 { + c.Fatal("AppArmor was unsuccessful in prohibiting chmod of /proc/* files.") + } + } +} + func (s *DockerSuite) TestRunCapAddSYSTIME(c *check.C) { testRequires(c, NativeExecDriver)