Commit d0bd6594 authored by Eric W. Biederman's avatar Eric W. Biederman

userns: Deprecate and rename the user_namespace reference in the user_struct

With a user_ns reference in struct cred the only user of the user namespace
reference in struct user_struct is to keep the uid hash table alive.

The user_namespace reference in struct user_struct will be going away soon, and
I have removed all of the references.  Rename the field from user_ns to _user_ns
so that the compiler can verify nothing follows the user struct to the user
namespace anymore.
Acked-by: default avatarSerge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
parent 6f9ac6d9
...@@ -729,7 +729,7 @@ struct user_struct { ...@@ -729,7 +729,7 @@ struct user_struct {
/* Hash table maintenance information */ /* Hash table maintenance information */
struct hlist_node uidhash_node; struct hlist_node uidhash_node;
uid_t uid; uid_t uid;
struct user_namespace *user_ns; struct user_namespace *_user_ns; /* Don't use will be removed soon */
#ifdef CONFIG_PERF_EVENTS #ifdef CONFIG_PERF_EVENTS
atomic_long_t locked_vm; atomic_long_t locked_vm;
......
...@@ -58,7 +58,7 @@ struct user_struct root_user = { ...@@ -58,7 +58,7 @@ struct user_struct root_user = {
.files = ATOMIC_INIT(0), .files = ATOMIC_INIT(0),
.sigpending = ATOMIC_INIT(0), .sigpending = ATOMIC_INIT(0),
.locked_shm = 0, .locked_shm = 0,
.user_ns = &init_user_ns, ._user_ns = &init_user_ns,
}; };
/* /*
...@@ -72,7 +72,7 @@ static void uid_hash_insert(struct user_struct *up, struct hlist_head *hashent) ...@@ -72,7 +72,7 @@ static void uid_hash_insert(struct user_struct *up, struct hlist_head *hashent)
static void uid_hash_remove(struct user_struct *up) static void uid_hash_remove(struct user_struct *up)
{ {
hlist_del_init(&up->uidhash_node); hlist_del_init(&up->uidhash_node);
put_user_ns(up->user_ns); put_user_ns(up->_user_ns); /* It is safe to free the uid hash table now */
} }
static struct user_struct *uid_hash_find(uid_t uid, struct hlist_head *hashent) static struct user_struct *uid_hash_find(uid_t uid, struct hlist_head *hashent)
...@@ -153,7 +153,7 @@ struct user_struct *alloc_uid(struct user_namespace *ns, uid_t uid) ...@@ -153,7 +153,7 @@ struct user_struct *alloc_uid(struct user_namespace *ns, uid_t uid)
new->uid = uid; new->uid = uid;
atomic_set(&new->__count, 1); atomic_set(&new->__count, 1);
new->user_ns = get_user_ns(ns); new->_user_ns = get_user_ns(ns);
/* /*
* Before adding this, check whether we raced * Before adding this, check whether we raced
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment