The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Miklos Szeredi <miklos@szeredi.hu>
To: akpm@linux-foundation.org, serue@us.ibm.com,
	viro@ftp.linux.org.uk, linuxram@us.ibm.com,
	ebiederm@xmission.com
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	containers@lists.osdl.org
Subject: [patch 05/10] Add "permit user submounts" flag to vfsmount
Date: Mon, 16 Apr 2007 13:03:13 +0200	[thread overview]
Message-ID: <20070416110414.591968270@szeredi.hu> (raw)
In-Reply-To: 20070416110308.739051445@szeredi.hu

[-- Attachment #1: permit_user_mounts_flag.patch --]
[-- Type: text/plain, Size: 2308 bytes --]

From: Miklos Szeredi <mszeredi@suse.cz>

If MNT_USERMNT flag is not set in the target vfsmount, then
unprivileged mounts will be denied.

By default this flag is cleared, and can be set on new mounts, on
remounts or with the MS_SETFLAGS option.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
---

Index: linux/fs/namespace.c
===================================================================
--- linux.orig/fs/namespace.c	2007-04-13 13:20:12.000000000 +0200
+++ linux/fs/namespace.c	2007-04-13 13:35:40.000000000 +0200
@@ -411,6 +411,7 @@ static int show_vfsmnt(struct seq_file *
 		{ MNT_NOATIME, ",noatime" },
 		{ MNT_NODIRATIME, ",nodiratime" },
 		{ MNT_RELATIME, ",relatime" },
+		{ MNT_USERMNT, ",usermnt" },
 		{ 0, NULL }
 	};
 	struct proc_fs_info *fs_infop;
@@ -1505,9 +1506,11 @@ long do_mount(char *dev_name, char *dir_
 		mnt_flags |= MNT_NODIRATIME;
 	if (flags & MS_RELATIME)
 		mnt_flags |= MNT_RELATIME;
+	if (flags & MS_USERMNT)
+		mnt_flags |= MNT_USERMNT;
 
 	flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE |
-		   MS_NOATIME | MS_NODIRATIME | MS_RELATIME);
+		   MS_NOATIME | MS_NODIRATIME | MS_RELATIME | MS_USERMNT);
 
 	/* ... and get the mountpoint */
 	retval = path_lookup(dir_name, LOOKUP_FOLLOW, &nd);
Index: linux/include/linux/mount.h
===================================================================
--- linux.orig/include/linux/mount.h	2007-04-13 13:17:08.000000000 +0200
+++ linux/include/linux/mount.h	2007-04-13 13:22:17.000000000 +0200
@@ -28,6 +28,7 @@ struct mnt_namespace;
 #define MNT_NOATIME	0x08
 #define MNT_NODIRATIME	0x10
 #define MNT_RELATIME	0x20
+#define MNT_USERMNT	0x40
 
 #define MNT_SHRINKABLE	0x100
 #define MNT_USER	0x200
Index: linux/include/linux/fs.h
===================================================================
--- linux.orig/include/linux/fs.h	2007-04-13 13:23:05.000000000 +0200
+++ linux/include/linux/fs.h	2007-04-13 13:35:34.000000000 +0200
@@ -130,6 +130,7 @@ extern int dir_notify_enable;
 #define MS_SETFLAGS	(1<<23) /* set specified mount flags */
 #define MS_CLEARFLAGS	(1<<24) /* clear specified mount flags */
 /* MS_SETFLAGS | MS_CLEARFLAGS: change mount flags to specified */
+#define MS_USERMNT	(1<<25) /* permit unpriv. submounts under this mount */
 #define MS_ACTIVE	(1<<30)
 #define MS_NOUSER	(1<<31)
 

--

  parent reply	other threads:[~2007-04-16 11:09 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-16 11:03 [patch 00/10] mount ownership and unprivileged mount syscall (v3) Miklos Szeredi
2007-04-16 11:03 ` [patch 01/10] add user mounts to the kernel Miklos Szeredi
2007-04-16 11:03 ` [patch 02/10] allow unprivileged umount Miklos Szeredi
2007-04-16 19:39   ` Eric W. Biederman
2007-04-16 19:58     ` Greg KH
2007-04-16 11:03 ` [patch 03/10] account user mounts Miklos Szeredi
2007-04-16 11:03 ` [patch 04/10] allow per-mount flags to be set/cleared individually Miklos Szeredi
2007-04-16 11:03 ` Miklos Szeredi [this message]
2007-04-16 19:20   ` [patch 05/10] Add "permit user submounts" flag to vfsmount Serge E. Hallyn
2007-04-17 10:44     ` Miklos Szeredi
2007-04-17 14:33       ` Serge E. Hallyn
2007-04-17 16:08         ` Miklos Szeredi
2007-04-17 16:54           ` Serge E. Hallyn
2007-04-16 11:03 ` [patch 06/10] propagate error values from clone_mnt Miklos Szeredi
2007-04-16 11:03 ` [patch 07/10] allow unprivileged bind mounts Miklos Szeredi
2007-04-16 11:03 ` [patch 08/10] put declaration of put_filesystem() in fs.h Miklos Szeredi
2007-04-16 11:03 ` [patch 09/10] allow unprivileged mounts Miklos Szeredi
2007-04-16 11:03 ` [patch 10/10] allow unprivileged fuse mounts Miklos Szeredi
2007-04-18  7:08 ` [patch 00/10] mount ownership and unprivileged mount syscall (v3) Jeremy Maitin-Shepard

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=20070416110414.591968270@szeredi.hu \
    --to=miklos@szeredi.hu \
    --cc=akpm@linux-foundation.org \
    --cc=containers@lists.osdl.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxram@us.ibm.com \
    --cc=serue@us.ibm.com \
    --cc=viro@ftp.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