mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Andrew Vagin <avagin@parallels.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
	Andrey Vagin <avagin@openvz.org>, <linux-fsdevel@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	Serge Hallyn <serge.hallyn@canonical.com>
Subject: [PATCH] mnt: Move the clear of MNT_LOCKED from copy_tree to it's
Date: Tue, 07 Oct 2014 16:40:10 -0700	[thread overview]
Message-ID: <87zjd7la91.fsf_-_@x220.int.ebiederm.org> (raw)
In-Reply-To: <878ukrmp1t.fsf@x220.int.ebiederm.org> (Eric W. Biederman's message of "Tue, 07 Oct 2014 16:35:10 -0700")


Clear MNT_LOCKED in the callers of copy_tree except copy_mnt_ns, and
collect_mounts.  In copy_mnt_nswe want an exact copy of a mount tree,
so not clearing MNT_LOCKED is important.  Similarly collect_mounts
is used to take a snapshot of the mount tree for audit logging purposes
and auditing using a faithful copy of the tree is important.

This becomes particularly significant when we start setting MNT_LOCKED
on rootfs to prevent it from being unmounted.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
---
 fs/namespace.c | 1 -
 fs/pnode.c     | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index 9c6ee037bef7..5a11e273541c 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1498,7 +1498,6 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
 	if (IS_ERR(q))
 		return q;
 
-	q->mnt.mnt_flags &= ~MNT_LOCKED;
 	q->mnt_mountpoint = mnt->mnt_mountpoint;
 
 	p = mnt;
diff --git a/fs/pnode.c b/fs/pnode.c
index aae331a5d03b..260ac8f898a4 100644
--- a/fs/pnode.c
+++ b/fs/pnode.c
@@ -242,6 +242,7 @@ static int propagate_one(struct mount *m)
 	child = copy_tree(last_source, last_source->mnt.mnt_root, type);
 	if (IS_ERR(child))
 		return PTR_ERR(child);
+	child->mnt.mnt_flags &= ~MNT_LOCKED;
 	mnt_set_mountpoint(m, mp, child);
 	last_dest = m;
 	last_source = child;
-- 
1.9.1


  reply	other threads:[~2014-10-07 23:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-07 12:00 [PATCH] mnt: don't allow to detach the namespace root Andrey Vagin
2014-10-07 13:24 ` Al Viro
2014-10-07 13:40   ` Andrew Vagin
2014-10-07 19:27     ` [PATCH] umount: Do not allow unmounting rootfs Eric W. Biederman
2014-10-07 19:53       ` Andrew Vagin
2014-10-07 20:58         ` Eric W. Biederman
2014-10-07 22:00           ` Andrew Vagin
2014-10-07 23:35             ` Eric W. Biederman
2014-10-07 23:40               ` Eric W. Biederman [this message]
2014-10-08 10:46                 ` [PATCH] mnt: Move the clear of MNT_LOCKED from copy_tree to it's Andrew Vagin
2014-10-08 10:47       ` [PATCH] umount: Do not allow unmounting rootfs Andrew Vagin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zjd7la91.fsf_-_@x220.int.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=avagin@openvz.org \
    --cc=avagin@parallels.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=serge.hallyn@canonical.com \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®