[CRIU] [PATCH 10/11] restore: set PR_SET_DUMPABLE to have access to proc files
Andrey Vagin
avagin at openvz.org
Wed Aug 13 00:51:37 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 9abb1c3..fd4f8fe 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1347,9 +1347,15 @@ static int restore_task_with_children(void *_arg)
exit(1);
/* 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