]> git.proxmox.com Git - mirror_lxcfs.git/commit - Makefile.am
Fix checking of parent directories
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Fri, 13 Nov 2015 23:07:36 +0000 (17:07 -0600)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Tue, 17 Nov 2015 18:33:13 +0000 (12:33 -0600)
commita8b6c3e0537e90fba3c55910fd1b7229d54a60a7
tree7547cb2fbbebb396d56fc0063da323292761169d
parentd09b7fffdde7ec659d17a1b2e252264d213ca274
Fix checking of parent directories

Taken from the justification in the launchpad bug:

To a task in freezer cgroup /a/b/c/d, it should appear that there are no
cgroups other than its descendents. Since this is a filesystem, we must have
the parent directories, but each parent cgroup should only contain the child
which the task can see.

So, when this task looks at /a/b, it should see only directory 'c' and no
files. Attempt to create /a/b/x should result in -EPERM, whether /a/b/x already
exists or not. Attempts to query /a/b/x should result in -ENOENT whether /a/b/x
exists or not. Opening /a/b/tasks should result in -ENOENT.

The caller_may_see_dir checks specifically whether a task may see a cgroup
directory - i.e. /a/b/x if opening /a/b/x/tasks, and /a/b/c/d if doing
opendir('/a/b/c/d').

caller_is_in_ancestor() will return true if the caller in /a/b/c/d looks at
/a/b/c/d/e. If the caller is in a child cgroup of the queried one - i.e. if the
task in /a/b/c/d queries /a/b, then *nextcg will container the next (the only)
directory which he can see in the path - 'c'.

Beyond this, regular DAC permissions should apply, with the
root-in-user-namespace privilege over its mapped uids being respected. The
fc_may_access check does this check for both directories and files.

This is CVE-2015-1342 (LP: #1508481)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Makefile.am
lxcfs.c
tests/test_confinement.sh [new file with mode: 0644]
tests/test_syscalls.c [new file with mode: 0644]