Skip to content

Commit f9ccb09

Browse files
committed
Rename cgroupNamespaceSupported, add details
This responds to review feedback from #4308 (review) Signed-off-by: Mark Yen <[email protected]>
1 parent d48bf06 commit f9ccb09

4 files changed

Lines changed: 8 additions & 4 deletions

File tree

executor/oci/spec.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func GenerateSpec(ctx context.Context, meta executor.Meta, mounts []executor.Mou
138138
return nil, nil, err
139139
}
140140

141-
if cgroupNamespaceSupported() {
141+
if cgroupV2NamespaceSupported() {
142142
s.Linux.Namespaces = append(s.Linux.Namespaces, specs.LinuxNamespace{
143143
Type: specs.CgroupNamespace,
144144
})

executor/oci/spec_freebsd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ func getTracingSocket() string {
5656
return ""
5757
}
5858

59-
func cgroupNamespaceSupported() bool {
59+
func cgroupV2NamespaceSupported() bool {
6060
return false
6161
}

executor/oci/spec_linux.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,11 @@ func getTracingSocket() string {
148148
return fmt.Sprintf("unix://%s", tracingSocketPath)
149149
}
150150

151-
func cgroupNamespaceSupported() bool {
151+
func cgroupV2NamespaceSupported() bool {
152+
// Check if cgroups v2 namespaces are supported. Trying to do cgroup
153+
// namespaces with cgroups v1 results in EINVAL when we encounter a
154+
// non-standard hierarchy.
155+
// See https://github.com/moby/buildkit/issues/4108
152156
cgroupNSOnce.Do(func() {
153157
if _, err := os.Stat("/proc/self/ns/cgroup"); os.IsNotExist(err) {
154158
return

executor/oci/spec_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,6 @@ func getTracingSocket() string {
9797
return fmt.Sprintf("npipe://%s", filepath.ToSlash(tracingSocketPath))
9898
}
9999

100-
func cgroupNamespaceSupported() bool {
100+
func cgroupV2NamespaceSupported() bool {
101101
return false
102102
}

0 commit comments

Comments
 (0)