[CRIU] [PATCH v4 27/31] shmem: Fixup shmem_wait_and_open() opens foreign /proc/[pid]/fd/[i]
Kirill Tkhai
ktkhai at virtuozzo.com
Wed Feb 22 03:34:32 PST 2017
When target process is in a user_ns, where we do not have a permissions,
we need use usernsd helper to get its fds.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
criu/shmem.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/criu/shmem.c b/criu/shmem.c
index fac4b83ef..21a9d8b9e 100644
--- a/criu/shmem.c
+++ b/criu/shmem.c
@@ -22,6 +22,7 @@
#include "types.h"
#include "page.h"
#include "util.h"
+#include "pstree.h"
#include "protobuf.h"
#include "images/pagemap.pb-c.h"
@@ -450,7 +451,8 @@ static int shmem_wait_and_open(int pid, struct shmem_info *si, VmaEntry *vi)
si->pid, si->fd);
pr_info("Opening shmem [%s] \n", path);
- ret = open_proc_rw(si->pid, "fd/%d", si->fd);
+ pid = pstree_pid_by_virt(si->pid)->real;
+ ret = open_fd_of_real_pid(pid, si->fd, O_RDWR);
futex_inc_and_wake(&si->lock);
if (ret < 0)
return -1;
More information about the CRIU
mailing list