[patch 03/10] unprivileged mounts: account user mounts

Previous thread: [patch 07/10] unprivileged mounts: allow unprivileged mounts by Miklos Szeredi on Friday, April 27, 2007 - 8:04 am. (1 message)

Next thread: [patch 04/10] unprivileged mounts: propagate error values from clone_mnt by Miklos Szeredi on Friday, April 27, 2007 - 8:04 am. (1 message)
To: <akpm@...>, <serue@...>, <viro@...>, <linuxram@...>, <ebiederm@...>, <kzak@...>
Cc: <linux-fsdevel@...>, <linux-kernel@...>, <containers@...>
Date: Friday, April 27, 2007 - 8:04 am

From: Miklos Szeredi <mszeredi@suse.cz>

Add sysctl variables for accounting and limiting the number of user
mounts.

The maximum number of user mounts is set to 1024 by default. This
won't in itself enable user mounts, setting a mount to be owned by a
user is first needed

[akpm]
- don't use enumerated sysctls

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

Index: linux/Documentation/filesystems/proc.txt
===================================================================
--- linux.orig/Documentation/filesystems/proc.txt 2007-04-26 13:08:35.000000000 +0200
+++ linux/Documentation/filesystems/proc.txt 2007-04-26 13:17:13.000000000 +0200
@@ -923,6 +923,15 @@ reaches aio-max-nr then io_setup will fa
raising aio-max-nr does not result in the pre-allocation or re-sizing
of any kernel data structures.

+nr_user_mounts and max_user_mounts
+----------------------------------
+
+These represent the number of "user" mounts and the maximum number of
+"user" mounts respectively. User mounts may be created by
+unprivileged users. User mounts may also be created with sysadmin
+privileges on behalf of a user, in which case nr_user_mounts may
+exceed max_user_mounts.
+
2.2 /proc/sys/fs/binfmt_misc - Miscellaneous binary formats
-----------------------------------------------------------

Index: linux/fs/namespace.c
===================================================================
--- linux.orig/fs/namespace.c 2007-04-26 13:16:21.000000000 +0200
+++ linux/fs/namespace.c 2007-04-26 13:17:13.000000000 +0200
@@ -39,6 +39,9 @@ static int hash_mask __read_mostly, hash
static struct kmem_cache *mnt_cache __read_mostly;
static struct rw_semaphore namespace_sem;

+int nr_user_mounts;
+int max_user_mounts = 1024;
+
/* /sys/fs */
decl_subsys(fs, NULL, NULL);
EXPORT_SYMBOL_GPL(fs_subsys);
@@ -227,11 +230,30 @@ static struct vfsmount *skip_mnt_tree(st
return p;
}

+static void dec_nr_user_mounts(void)
+{
+ spin_lock(&vfsmount_lock);
+ nr_user...

Previous thread: [patch 07/10] unprivileged mounts: allow unprivileged mounts by Miklos Szeredi on Friday, April 27, 2007 - 8:04 am. (1 message)

Next thread: [patch 04/10] unprivileged mounts: propagate error values from clone_mnt by Miklos Szeredi on Friday, April 27, 2007 - 8:04 am. (1 message)