[Devel] [PATCH CRIU 6/6] mount: Switch user_ns before mount binfmt_misc

Kirill Tkhai ktkhai at virtuozzo.com
Sat Jul 15 16:50:32 MSK 2017


Recent RHEL7 update introduced commit 1352424aae37:
"ms/fs: Add user namespace member to struct super_bloc",
so now we have to change user_ns before binfmt_misc
mount.

https://jira.sw.ru/browse/PSBM-68377

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/mount.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/criu/mount.c b/criu/mount.c
index 36babe721..66119c331 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -1441,6 +1441,12 @@ static __maybe_unused int mount_cr_time_mount(struct ns_id *ns, unsigned int *s_
 		goto out;
 	}
 
+	ret = switch_ns(ns->ns_pid, &user_ns_desc, NULL);
+	if (ret < 0) {
+		pr_err("Can't switch user_ns\n");
+		goto out;
+	}
+
 	ret = mount(source, target, type, 0, NULL);
 	if (ret < 0) {
 		exit_code = -errno;



More information about the Devel mailing list