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

Submitted by Radostin Stoyanov on Nov. 10, 2019, 9:15 a.m.

Details

Message ID 20191110091523.24426-4-rstoyanov1@gmail.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Radostin Stoyanov Nov. 10, 2019, 9:15 a.m.
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@gmail.com>
---
 criu/cr-restore.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

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;
 		}