]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgroups: don't escape if we're not real root 2212/head
authorTycho Andersen <tycho@tycho.ws>
Tue, 13 Mar 2018 15:57:10 +0000 (15:57 +0000)
committerTycho Andersen <tycho@tycho.ws>
Tue, 13 Mar 2018 15:57:10 +0000 (15:57 +0000)
If we're host unpriv but root in our userns, we can't really escape
cgroups. Let's switch the cgroup escape test to reflect this.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
src/lxc/cgroups/cgfsng.c

index 10c7ab2cf0d983a3d3c277e466cac4f9345b0d77..f337be449ab7fd1da1bbf4627352043bfe551cab 100644 (file)
@@ -1368,7 +1368,7 @@ static char *cg_unified_get_current_cgroup(void)
        bool will_escape;
        char *copy = NULL;
 
-       will_escape = (geteuid() == 0);
+       will_escape = !am_host_unpriv();
        if (will_escape)
                basecginfo = read_file("/proc/1/cgroup");
        else