]> git.ipfire.org Git - thirdparty/lxc.git/commit
add_device_node: act in a chroot
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Fri, 7 Feb 2014 19:00:50 +0000 (13:00 -0600)
committerStéphane Graber <stgraber@ubuntu.com>
Fri, 7 Feb 2014 19:21:58 +0000 (14:21 -0500)
commitd5aa23e662fd9c64bf72df47f74765e5232f0a96
tree951b692b7ec57d7941a6da7d1420f40a994b7221
parentb8ac27509024c1347e4ad6cc079e92d160ae77f7
add_device_node: act in a chroot

The goal is to avoid an absolute symlink in the guest redirecting
us to the host's /dev.  Thanks to the libvirt team for considering
that possibility!

We want to work on kernels which do not support setns, so we simply
chroot into the container before doing any rm/mknod.  If /dev/vda5
is a symlink to /XXX, or /dev is a symlink to /etc, this is now
correctly resolved locally in the chroot.

We would have preferred to use realpath() to check that the resolved
path is not changed, but realpath across /proc/pid/root does not
work as expected.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/lxccontainer.c