]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: skip TestUseCgroupFD if cgroupfs mounted RO
authorPaul E. Murphy <murp@ibm.com>
Mon, 12 Dec 2022 15:31:59 +0000 (09:31 -0600)
committerGopher Robot <gobot@golang.org>
Mon, 12 Dec 2022 23:10:52 +0000 (23:10 +0000)
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 <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>

src/syscall/exec_linux_test.go

index a035d415ed539a83495b77317c54664ff9369e4b..1e21fffaef9f1c8ae56eee2959caa373d451f534 100644 (file)
@@ -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)