]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgroups: don't escape if we're not real root
authorTycho Andersen <tycho@tycho.ws>
Tue, 13 Mar 2018 15:57:10 +0000 (15:57 +0000)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 23 Aug 2018 20:43:57 +0000 (22:43 +0200)
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 a17d59b1275ac7eeab25ac45e5b7f4f1450ad9e2..088b6c94f8ef8f949bce668120f64402e6161cab 100644 (file)
@@ -1357,7 +1357,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