]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: update check for UserNS support for CentOS 7.5+
authorEduRam <eduardo.ramalho@gmail.com>
Tue, 17 Jul 2018 22:59:35 +0000 (22:59 +0000)
committerIan Lance Taylor <iant@golang.org>
Wed, 18 Jul 2018 01:16:24 +0000 (01:16 +0000)
Fixes #26385

Change-Id: I5594564f42898a71d30531e5132bddb3a6915247
GitHub-Last-Rev: fbd7b38b0419e21ecd22fe802ede5c0ee3f14a9a
GitHub-Pull-Request: golang/go#26427
Reviewed-on: https://go-review.googlesource.com/124555
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/syscall/exec_linux_test.go

index 17df8f445ee822b5351cb1d3f739754c850fd2ad..f551e87736d98b73eb4c413cd174c2f4a1931a38 100644 (file)
@@ -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.