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-next>] [day] [month] [year] [list]
Message-Id: <20090803215940.DF984602@kernel>
Date:	Mon, 03 Aug 2009 14:59:40 -0700
From:	Dave Hansen <dave@...ux.vnet.ibm.com>
To:	Al Viro <viro@...iv.linux.org.uk>
Cc:	Nick Piggin <npiggin@...e.de>, linux-kernel@...r.kernel.org,
	OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>,
	Dave Hansen <dave@...ux.vnet.ibm.com>
Subject: [RFC][PATCH 1/2] pin kern mounts as writable


If we are going to continue to use mnt_clone_write() inside
of init_file(), then we're going to need some kind of extra
handling.

What I want to do in the next patch is add a debugging check
in mnt_clone_write() to double-check that there *is* a real
writer on the mount before mnt_clone_write() succeeds.  To
do that, we either need to check for MS_KERNMOUNT around
that debug check, or we need to make sure that these kern
mounts *have* a write already.

I'm choosing to make sure they always have a write.

---

 linux-2.6.git-dave/fs/super.c |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff -puN fs/super.c~pin-mnt-writable fs/super.c
--- linux-2.6.git/fs/super.c~pin-mnt-writable	2009-08-03 14:47:29.000000000 -0700
+++ linux-2.6.git-dave/fs/super.c	2009-08-03 14:49:49.000000000 -0700
@@ -948,7 +948,19 @@ EXPORT_SYMBOL_GPL(do_kern_mount);
 
 struct vfsmount *kern_mount_data(struct file_system_type *type, void *data)
 {
-	return vfs_kern_mount(type, MS_KERNMOUNT, type->name, data);
+	int err = 0;
+	struct vfsmount *mnt;
+	mnt = vfs_kern_mount(type, MS_KERNMOUNT, type->name, data);
+	if (IS_ERR(mnt))
+		return mnt;
+	/*
+	 * We will never allow this mount to be r/o.  Doing
+	 * this makes it explicit and allows mnt_clone_write()
+	 * to be used unconditionally on this mount.
+	 */
+	err = mnt_want_write(mnt);
+	WARN_ON(err);
+	return mnt;
 }
 
 EXPORT_SYMBOL_GPL(kern_mount_data);
diff -puN include/linux/mount.h~pin-mnt-writable include/linux/mount.h
_
--
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