diff options
author | EduRam <eduardo.ramalho@gmail.com> | 2018-07-17 22:59:35 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2018-07-18 01:16:24 +0000 |
commit | ce09ce4ae0116d2056e8864fe2c2fd3abbc5375a (patch) | |
tree | 84fce2f0fdf726ea495ea59b20b0f85841d5a1c5 /src/syscall/exec_linux_test.go | |
parent | f3cdc94154f75880ddd5d47d3cb78121aa622d22 (diff) | |
download | go-git-ce09ce4ae0116d2056e8864fe2c2fd3abbc5375a.tar.gz |
syscall: update check for UserNS support for CentOS 7.5+
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>
Diffstat (limited to 'src/syscall/exec_linux_test.go')
-rw-r--r-- | src/syscall/exec_linux_test.go | 9 |
1 files changed, 9 insertions, 0 deletions
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. |