[CRIU] [PATCH 10/14] restore: set PR_SET_DUMPABLE to have access to proc files
Andrey Vagin
avagin at openvz.org
Tue Oct 14 04:38:24 PDT 2014
It is cleared when a process is forked in a new userns.
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
cr-restore.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/cr-restore.c b/cr-restore.c
index 8944b93..0710e87 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1417,9 +1417,15 @@ static int restore_task_with_children(void *_arg)
goto err;
/* UID and GID must be set after restoring /proc/PID/{uid,gid}_maps */
- if ((ca->clone_flags & CLONE_NEWUSER) && (setuid(0) || setgid(0))) {
- pr_perror("Unable to initialize id-s");
- exit(1);
+ if ((ca->clone_flags & CLONE_NEWUSER)) {
+ if (setuid(0) || setgid(0)) {
+ pr_perror("Unable to initialize id-s");
+ exit(1);
+ }
+ if (prctl(PR_SET_DUMPABLE, 1, 0)) {
+ pr_perror("Unable to set PR_SET_DUMPABLE");
+ exit(1);
+ }
}
if (prepare_namespace(current, ca->clone_flags))
--
1.9.3
More information about the CRIU
mailing list