diff options
author | 2021-12-21 12:32:26 -0800 | |
---|---|---|
committer | 2021-12-21 12:32:26 -0800 | |
commit | 24ae730736caaef485a8a923411aa30305a00eec (patch) | |
tree | f1830fb8d24ecd0c63fb7d8a57966b79da53990d | |
parent | Disable pip version checks in the Docker image (diff) |
Show a warning if use_cgroupv2 is true but only a v1 fs is detected
The NsJail config can be overridden by command-line arguments. However,
there is no way to negate `--use_cgroupv2`. Hence, manual correction
of the config by the user is required.
-rw-r--r-- | snekbox/utils/cgroup.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/snekbox/utils/cgroup.py b/snekbox/utils/cgroup.py index bdc2fe0..3df269e 100644 --- a/snekbox/utils/cgroup.py +++ b/snekbox/utils/cgroup.py @@ -75,6 +75,13 @@ def get_version(config: NsJailConfig) -> int: # Probably hybrid mode. Use whatever is set in the config. return config_version elif v1_exists: + if config_version == 2: + log.warning( + "NsJail is configured to use cgroupv2, but only cgroupv1 was detected on the " + "system. Either use_cgroupv2 or cgroupv2_mount is incorrect. Snekbox is unable " + "to override use_cgroupv2. If NsJail has been configured to use cgroups, then " + "it will fail. In such case, please correct the config manually." + ) return 1 elif v2_exists: return 2 |