Allow libcontainer to eval symlink destination

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Add tests for mounting into /proc and /sys

These two locations should be prohibited from mounting volumes into
those destinations.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2015-04-30 14:08:02 -07:00
parent 83c5131acd
commit d5ebb60bdd
2 changed files with 19 additions and 8 deletions
+18
View File
@@ -3487,3 +3487,21 @@ func TestRunReadProcLatency(t *testing.T) {
}
logDone("run - read /proc/latency_stats")
}
func TestMountIntoProc(t *testing.T) {
defer deleteAllContainers()
code, err := runCommand(exec.Command(dockerBinary, "run", "-v", "/proc//sys", "busybox", "true"))
if err == nil || code == 0 {
t.Fatal("container should not be able to mount into /proc")
}
logDone("run - mount into proc")
}
func TestMountIntoSys(t *testing.T) {
defer deleteAllContainers()
code, err := runCommand(exec.Command(dockerBinary, "run", "-v", "/sys/", "busybox", "true"))
if err == nil || code == 0 {
t.Fatal("container should not be able to mount into /sys")
}
logDone("run - mount into sys")
}