[CRIU] [PATCH 4/4] restore: Create temp proc in /tmp

Radostin Stoyanov rstoyanov1 at gmail.com
Sun Nov 10 12:15:23 MSK 2019


When restoring a container with user namespace, CRIU fails to create
a temporary directory for proc. The is because the unprivileged user
that has been just restored does not have permissions to access the
working directory used by CRIU.

Resolves #828

Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
---
 criu/cr-restore.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index de0b2cb40..4f7a3bcc2 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1589,13 +1589,14 @@ static void restore_pgid(void)
 static int mount_proc(void)
 {
 	int fd, ret;
-	char proc_mountpoint[] = "crtools-proc.XXXXXX";
+	char proc_mountpoint[] = "/tmp/crtools-proc.XXXXXX";
 
 	if (root_ns_mask == 0)
 		fd = ret = open("/proc", O_DIRECTORY);
 	else {
 		if (mkdtemp(proc_mountpoint) == NULL) {
-			pr_perror("mkdtemp failed %s", proc_mountpoint);
+			pr_perror("Failed to create temp directory %s/%s",
+				get_current_dir_name(), proc_mountpoint);
 			return -1;
 		}
 
-- 
2.21.0



More information about the CRIU mailing list