lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120221180139.25235.73784.stgit@warthog.procyon.org.uk>
Date:	Tue, 21 Feb 2012 18:01:39 +0000
From:	David Howells <dhowells@...hat.com>
To:	linux-fsdevel@...r.kernel.org, viro@...IV.linux.org.uk,
	valerie.aurora@...il.com
Cc:	linux-kernel@...r.kernel.org, David Howells <dhowells@...hat.com>
Subject: [PATCH 33/73] unionmount: Mark lower layers in union [ver #2]

Mark lower layers in union to make it easier to tell when they're being
accessed - just in case a file gets mounted over a unioned lower file.

Signed-off-by: David Howells <dhowells@...hat.com>
---

 fs/namespace.c        |    5 ++++-
 fs/pnode.h            |    1 +
 fs/union.h            |    5 +++++
 include/linux/mount.h |    1 +
 4 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index 5fbe3b0..1f24a6b 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -787,6 +787,9 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
 	list_add_tail(&mnt->mnt_instance, &sb->s_mounts);
 	br_write_unlock(vfsmount_lock);
 
+	if ((flag & CL_MAKE_UNION))
+		mnt->mnt.mnt_flags |= MNT_UNION_LOWER;
+
 	if (flag & CL_SLAVE) {
 		list_add(&mnt->mnt_slave, &old->mnt_slave_list);
 		mnt->mnt_master = old;
@@ -1509,7 +1512,7 @@ static int clone_union_tree(struct mount *topmost, struct path *mntpnt)
 	cloned_tree = copy_tree(mnt, mnt->mnt.mnt_root,
 				CL_COPY_ALL | CL_PRIVATE |
 				CL_NO_SHARED | CL_NO_SLAVE |
-				CL_MAKE_HARD_READONLY);
+				CL_MAKE_HARD_READONLY | CL_MAKE_UNION);
 	if (IS_ERR(cloned_tree))
 		return PTR_ERR(cloned_tree);
 
diff --git a/fs/pnode.h b/fs/pnode.h
index 321d7ab..3fd2afe 100644
--- a/fs/pnode.h
+++ b/fs/pnode.h
@@ -25,6 +25,7 @@
 #define CL_NO_SHARED 		0x20
 #define CL_NO_SLAVE 		0x40
 #define CL_MAKE_HARD_READONLY	0x80
+#define CL_MAKE_UNION		0x100
 
 static inline void set_mnt_shared(struct mount *mnt)
 {
diff --git a/fs/union.h b/fs/union.h
index 757f28c..48a9277 100644
--- a/fs/union.h
+++ b/fs/union.h
@@ -56,6 +56,11 @@ static inline bool IS_MNT_UNION(struct vfsmount *mnt)
 	return mnt->mnt_flags & MNT_UNION;
 }
 
+static inline bool IS_MNT_LOWER(struct vfsmount *mnt)
+{
+	return mnt->mnt_flags & MNT_UNION_LOWER;
+}
+
 static inline bool IS_DIR_UNIONED(struct dentry *dentry)
 {
 	return !!dentry->d_union_stack;
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 67f46fa..bd21196 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -48,6 +48,7 @@ struct mnt_namespace;
 #define MNT_INTERNAL	0x4000
 #define MNT_HARD_READONLY	0x8000	/* has a hard read-only ref on the sb */
 #define MNT_UNION	0x10000		/* top layer of a union mount */
+#define MNT_UNION_LOWER	0x20000		/* lower layer of a union mount */
 
 struct vfsmount {
 	struct dentry *mnt_root;	/* root of the mounted tree */

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ