Fix named cgroup handling in docker (#980)
authorJan Vorlicek <janvorli@microsoft.com>
Wed, 18 Dec 2019 16:07:36 +0000 (17:07 +0100)
committerGitHub <noreply@github.com>
Wed, 18 Dec 2019 16:07:36 +0000 (17:07 +0100)
commit1ed0a5661b5b9f2d9938478bad97140bbb272dc6
treee7edec2fa68ed9e8476379bfecaa0eb31e6133e6
parente1bc9a2faf643c75d01ce5937b84f4db0eeb657f
Fix named cgroup handling in docker (#980)

While named cgroups work fine outside of docker container, they weren't
working when created and used inside of a docker container. The problem
was caused by the fact that the hierarchy root extracted from
/proc/self/mountinfo and the cgroup path extracted from /proc/self/cgroup
are not equal for named groups. They just share the same prefix.
The cgroups handling code was not epxecting this case and ended up building
the final cgroup path incorrectly (including the common part of the path).
This change fixes it by checking for matching prefix of the paths instead
of comparing the whole paths.
src/coreclr/src/gc/unix/cgroup.cpp
src/coreclr/src/pal/src/misc/cgroup.cpp