From b16e94d13d0f9b84ed92563a12984190f91ead66 Mon Sep 17 00:00:00 2001 From: "Paul E. Murphy" Date: Mon, 12 Dec 2022 09:31:59 -0600 Subject: [PATCH] syscall: skip TestUseCgroupFD if cgroupfs mounted RO The skipping logic should also trigger if /sys/fs/cgroup is mounted read-only too. This is how it is mounted on the ppc64le/p10 containers today. Fixes #57262 Change-Id: Idc0ab050052ebf5777ac09f9519215b437b0ee7c Reviewed-on: https://go-review.googlesource.com/c/go/+/456835 Reviewed-by: Ian Lance Taylor TryBot-Result: Gopher Robot Reviewed-by: Bryan Mills Auto-Submit: Bryan Mills Run-TryBot: Paul Murphy --- src/syscall/exec_linux_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/syscall/exec_linux_test.go b/src/syscall/exec_linux_test.go index a035d415ed..1e21fffaef 100644 --- a/src/syscall/exec_linux_test.go +++ b/src/syscall/exec_linux_test.go @@ -8,6 +8,7 @@ package syscall_test import ( "bytes" + "errors" "flag" "fmt" "internal/testenv" @@ -504,7 +505,8 @@ func prepareCgroupFD(t *testing.T) (int, string) { // Need an ability to create a sub-cgroup. subCgroup, err := os.MkdirTemp(prefix+string(bytes.TrimSpace(cg)), "subcg-") if err != nil { - if os.IsPermission(err) { + // Running in an unprivileged container, this may also return EROFS #57262. + if os.IsPermission(err) || errors.Is(err, syscall.EROFS) { t.Skip(err) } t.Fatal(err) -- 2.48.1