]> git.ipfire.org Git - thirdparty/lxc.git/commit
attach: correctly handle namespace inheritance 1883/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Sun, 29 Oct 2017 11:19:43 +0000 (12:19 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sun, 29 Oct 2017 11:27:52 +0000 (12:27 +0100)
commit299d11981846980e50d0c6ea50c4a9e8c9bca6a3
tree63c370956cc9dd998192018fb1a7dcf82876f0d0
parentf3d91bf09a32dab27fe47c113051f081750aed7d
attach: correctly handle namespace inheritance

When attaching to a container's namespaces we did not handle the case where we
inherited namespaces correctly. In essence, liblxc on start records the
namespaces the container was created with in the handler. But it only records
the clone flags that were passed to clone() and doesn't record the namespaces
we e.g. inherited from other containers. This means that attach only ever
attached to the clone flags. But this is only correct if all other namespaces
not recorded in the handler refer to the namespaces of the caller. However,
this need not be the case if the container has inherited namespaces from
another container. To handle this case we need to check whether caller and
container are in the same namespace. If they are, we know that things are all
good. If they aren't then we need to attach to these namespaces as well.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/attach.c