[CRIU] [PATCH 0/3] mount: open a root directory for mount namesapces via the root task

Andrey Vagin avagin at openvz.org
Wed Jul 27 11:21:04 PDT 2016


From: Andrew Vagin <avagin at virtuozzo.com>

We use openat() syscall to open files in various mount namespaces.
Recently we found that if a path contains absolute symlinks, openat()
syscall resolves them relative to the current root, but they has to be
resolved relative to the root of the target namespace, so we need to
change root before restoring a file descriprot.

But for that we need to rework a method how we open a root directory
for a specified mount namespace. Currently we open /proc/pid/root for
one of processes from this namespace. If a process will change a root
directory, this way will not work.

In this patch we open all namespaces in the root task and then any
process will be able to open one of these descriptors via /proc/pid/fd.

Andrew Vagin (3):
  files: add a function to reopen fd as an unused fd
  files: split collect_fd on allocate_fd and handle_fd
  mount: open a root directory for mount namesapces via the root task

 criu/cr-restore.c    | 50 ++++++++++++++++++++------------
 criu/files.c         | 80 ++++++++++++++++++++++++++++++++++++++++++++++------
 criu/include/files.h |  3 ++
 criu/mount.c         | 48 ++++++++++++++++++++-----------
 criu/pstree.c        |  1 +
 5 files changed, 139 insertions(+), 43 deletions(-)

-- 
2.7.4



More information about the CRIU mailing list