mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Only run sandbox in child cgroup if using cgroupv2
Joining a non-leaf node cgroup is only illegal in hierarchical cgroup accounting. PiperOrigin-RevId: 493992577
This commit is contained in:
committed by
gVisor bot
parent
d17af25336
commit
2ff7a2750a
@@ -255,8 +255,8 @@ func New(conf *config.Config, args Args) (*Container, error) {
|
||||
return nil, fmt.Errorf("cannot set up cgroup for root: %w", err)
|
||||
}
|
||||
// Join the child cgroup when using cgroupfs. Joining non leaf-node
|
||||
// cgroups is illegal in Linux and will return EBUSY.
|
||||
if subCgroup != nil && !conf.SystemdCgroup {
|
||||
// cgroups is illegal in cgroupsv2 and will return EBUSY.
|
||||
if subCgroup != nil && !conf.SystemdCgroup && cgroup.IsOnlyV2() {
|
||||
containerCgroup = subCgroup
|
||||
} else {
|
||||
containerCgroup = parentCgroup
|
||||
|
||||
Reference in New Issue
Block a user