aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/user.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2011-11-17 04:32:59 -0500
committerEric W. Biederman <ebiederm@xmission.com>2012-04-26 05:00:59 -0400
commit783291e6900292521a3895583785e0c04a56c5b3 (patch)
tree9dd368a25ea61b5913646b1d93ec99e865c058ba /kernel/user.c
parent7b44ab978b77a91b327058a0f4db7e6fcdb90b92 (diff)
userns: Simplify the user_namespace by making userns->creator a kuid.
- Transform userns->creator from a user_struct reference to a simple kuid_t, kgid_t pair. In cap_capable this allows the check to see if we are the creator of a namespace to become the classic suser style euid permission check. This allows us to remove the need for a struct cred in the mapping functions and still be able to dispaly the user namespace creators uid and gid as 0. - Remove the now unnecessary delayed_work in free_user_ns. All that is left for free_user_ns to do is to call kmem_cache_free and put_user_ns. Those functions can be called in any context so call them directly from free_user_ns removing the need for delayed work. Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'kernel/user.c')
-rw-r--r--kernel/user.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/user.c b/kernel/user.c
index 025077e54a7c..cff385659175 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -25,7 +25,8 @@ struct user_namespace init_user_ns = {
25 .kref = { 25 .kref = {
26 .refcount = ATOMIC_INIT(3), 26 .refcount = ATOMIC_INIT(3),
27 }, 27 },
28 .creator = &root_user, 28 .owner = GLOBAL_ROOT_UID,
29 .group = GLOBAL_ROOT_GID,
29}; 30};
30EXPORT_SYMBOL_GPL(init_user_ns); 31EXPORT_SYMBOL_GPL(init_user_ns);
31 32
@@ -54,9 +55,9 @@ struct hlist_head uidhash_table[UIDHASH_SZ];
54 */ 55 */
55static DEFINE_SPINLOCK(uidhash_lock); 56static DEFINE_SPINLOCK(uidhash_lock);
56 57
57/* root_user.__count is 2, 1 for init task cred, 1 for init_user_ns->user_ns */ 58/* root_user.__count is 1, for init task cred */
58struct user_struct root_user = { 59struct user_struct root_user = {
59 .__count = ATOMIC_INIT(2), 60 .__count = ATOMIC_INIT(1),
60 .processes = ATOMIC_INIT(1), 61 .processes = ATOMIC_INIT(1),
61 .files = ATOMIC_INIT(0), 62 .files = ATOMIC_INIT(0),
62 .sigpending = ATOMIC_INIT(0), 63 .sigpending = ATOMIC_INIT(0),