[CRIU] [PATCH 1/1] do_new_mount() should clear all do_change_type() bits

Oleg Nesterov oleg at redhat.com
Mon Apr 13 07:02:38 PDT 2015


do_new_mount() clears MS_SHARED but this is not enough. It should clear
all bits processed in restore_shared_options().

The patch also adds MS_UNBINDABLE to MS_CHANGE_TYPE_MASK even if it is
not currently used. Just to match the kernel's do_change_type() check.

Signed-off-by: Oleg Nesterov <oleg at redhat.com>
---
 mount.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/mount.c b/mount.c
index 8b57729..55d5f8b 100644
--- a/mount.c
+++ b/mount.c
@@ -1750,6 +1750,9 @@ skip_parent:
 	return 0;
 }
 
+#define MS_CHANGE_TYPE_MASK	\
+	(MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE)
+
 static int do_new_mount(struct mount_info *mi)
 {
 	char *src;
@@ -1760,7 +1763,7 @@ static int do_new_mount(struct mount_info *mi)
 		return -1;
 
 	if (mount(src, mi->mountpoint, tp->name,
-			mi->flags & (~MS_SHARED), mi->options) < 0) {
+			mi->flags & ~MS_CHANGE_TYPE_MASK, mi->options) < 0) {
 		pr_perror("Can't mount at %s", mi->mountpoint);
 		return -1;
 	}
-- 
1.5.5.1




More information about the CRIU mailing list