From fbd7b38b0419e21ecd22fe802ede5c0ee3f14a9a Mon Sep 17 00:00:00 2001 From: EduRam Date: Tue, 17 Jul 2018 18:47:23 -0400 Subject: [PATCH] Check user namespaces on Centos7 --- src/syscall/exec_linux_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/syscall/exec_linux_test.go b/src/syscall/exec_linux_test.go index 17df8f445e..f551e87736 100644 --- a/src/syscall/exec_linux_test.go +++ b/src/syscall/exec_linux_test.go @@ -84,6 +84,15 @@ func checkUserNS(t *testing.T) { t.Skip("kernel doesn't support user namespaces") } } + + // On Centos 7.5+, user namespaces are disabled if user.max_user_namespaces = 0 + if _, err := os.Stat("/proc/sys/user/max_user_namespaces"); err == nil { + buf, errRead := ioutil.ReadFile("/proc/sys/user/max_user_namespaces") + if errRead == nil && buf[0] == '0' { + t.Skip("kernel doesn't support user namespaces") + } + } + // When running under the Go continuous build, skip tests for // now when under Kubernetes. (where things are root but not quite) // Both of these are our own environment variables.