[2/5] files: don't use PROC_SELF during restoring file descriptors

Submitted by Andrei Vagin on Jan. 2, 2019, 7:06 a.m.

Details

Message ID 20190102070642.27270-3-avagin@gmail.com
State Accepted
Series "travix: a few fixes for docker and fedora jobs"
Headers show

Commit Message

Andrei Vagin Jan. 2, 2019, 7:06 a.m.
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@gmail.com>
---
 criu/files-reg.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

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;