Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support using cgroups inside run #436

PhilippWendler opened this issue Jul 10, 2019 · 0 comments

Support using cgroups inside run #436

PhilippWendler opened this issue Jul 10, 2019 · 0 comments
cgroups container related to container mode


Copy link

Sometimes the benchmarked process wants to use cgroups itself. BenchExec prevents this (in container mode) by mounting the cgroup hierarchy read-only. If we would not do this, the benchmarked process could interfere with the benchmarking (e.g., by moving itself out of our cgroup, or changing the memory limit).

To fully support this, the following needs to be done:

  1. We need to mount the cgroup mounts in the namespace such that all other cgroups are invisible.
  2. We need to prevent the process from interfering with the limits set in the cgroup that is now the root of the visible hierarchy.
  3. /proc/self/cgroup needs to show the cgroups relative to the new root cgroup.

Item 3. can be achieved with cgroup namespaces. Originally this was planned only for cgroup-v2, which we do not support yet (#133), but reworked for cgroup-v1 and at least on Ubuntu 18.04 it is usable.

With cgroup namespaces, Item 1. should also be possible if we remount the cgroup hierarchy. However, I did not yet manage to the example from the man page working with unprivileged (user) namespaces. An alternative could be bind-mounting the cgroups of the existing hierarchy to the cgroup root.

Item 2. would be doable with cgroup-v2 and nsdelegate (cf. man page). Without cgroup-v2 we could probably do it by using a nested cgroup, where we set the limits in the outer cgroup and make only the inner cgroup available in the container.

@PhilippWendler PhilippWendler added the container related to container mode label Jul 10, 2019
@PhilippWendler PhilippWendler modified the milestone: Release 2.0 Jul 10, 2019
PhilippWendler added a commit that referenced this issue Jul 10, 2019
This works for /proc/self/cgroup,
but has no effect on the mounted cgroup hierarchy.

Cf. #436 for more information
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
cgroups container related to container mode

No branches or pull requests

1 participant