Skip to content

Commit 0d482b3

Browse files
jessfrazbradfitz
authored andcommitted
syscall: update check for UserNS support for centos 7
Fixes #20796 Fixes #16283 Change-Id: Ib11992fbd2bc1fbb3b14ae5a6bf0da2e4c12f641 Reviewed-on: https://go-review.googlesource.com/49311 Reviewed-by: Brad Fitzpatrick <[email protected]> Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent f0cf740 commit 0d482b3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/syscall/exec_linux_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ func checkUserNS(t *testing.T) {
5757
t.Skip("kernel prohibits user namespace in unprivileged process")
5858
}
5959
}
60+
// On Centos 7 make sure they set the kernel parameter user_namespace=1
61+
// See issue 16283 and 20796.
62+
if _, err := os.Stat("/sys/module/user_namespace/parameters/enable"); err == nil {
63+
buf, _ := ioutil.ReadFile("/sys/module/user_namespace/parameters/enabled")
64+
if !strings.HasPrefix(string(buf), "Y") {
65+
t.Skip("kernel doesn't support user namespaces")
66+
}
67+
}
6068
// When running under the Go continuous build, skip tests for
6169
// now when under Kubernetes. (where things are root but not quite)
6270
// Both of these are our own environment variables.

0 commit comments

Comments
 (0)