[CRIU] [PATCH 2/5] files: don't use PROC_SELF during restoring file descriptors
Andrei Vagin
avagin at gmail.com
Wed Jan 2 10:06:39 MSK 2019
open_proc_pid(PROC_SELF) returns a non-service file descriptor,
but it can take a place of a target file descriptor.
Signed-off-by: Andrei Vagin <avagin at gmail.com>
---
criu/files-reg.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/criu/files-reg.c b/criu/files-reg.c
index a20589b56..810cf8dc6 100644
--- a/criu/files-reg.c
+++ b/criu/files-reg.c
@@ -1634,7 +1634,11 @@ int open_path(struct file_desc *d,
tmp = inherit_fd_lookup_id(rfi->rfe->name);
if (tmp >= 0) {
inh_fd = tmp;
- mntns_root = open_pid_proc(PROC_SELF);
+ /*
+ * PROC_SELF isn't used, because only service
+ * descriptors can be used here.
+ */
+ mntns_root = open_pid_proc(getpid());
snprintf(path, sizeof(path), "fd/%d", tmp);
orig_path = rfi->path;
rfi->path = path;
--
2.17.2
More information about the CRIU
mailing list