diff options
| author | Eric W. Biederman <ebiederm@xmission.com> | 2011-11-17 02:20:58 -0500 |
|---|---|---|
| committer | Eric W. Biederman <ebiederm@xmission.com> | 2012-04-07 19:55:54 -0400 |
| commit | d0bd6594e286bd6145e04e19e8d3fa2e902cb800 (patch) | |
| tree | ec512935f5cf2b4ae95927a47e96ad716159fb04 | |
| parent | 6f9ac6d93a0916de09d11b0a247ade8f4347728b (diff) | |
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: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
| -rw-r--r-- | include/linux/sched.h | 2 | ||||
| -rw-r--r-- | kernel/user.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 720ce8d98a7..6867ae9bc8a 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -729,7 +729,7 @@ struct user_struct { | |||
| 729 | /* Hash table maintenance information */ | 729 | /* Hash table maintenance information */ |
| 730 | struct hlist_node uidhash_node; | 730 | struct hlist_node uidhash_node; |
| 731 | uid_t uid; | 731 | uid_t uid; |
| 732 | struct user_namespace *user_ns; | 732 | struct user_namespace *_user_ns; /* Don't use will be removed soon */ |
| 733 | 733 | ||
| 734 | #ifdef CONFIG_PERF_EVENTS | 734 | #ifdef CONFIG_PERF_EVENTS |
| 735 | atomic_long_t locked_vm; | 735 | atomic_long_t locked_vm; |
diff --git a/kernel/user.c b/kernel/user.c index 71dd2363ab0..d65fec0615a 100644 --- a/kernel/user.c +++ b/kernel/user.c | |||
| @@ -58,7 +58,7 @@ struct user_struct root_user = { | |||
| 58 | .files = ATOMIC_INIT(0), | 58 | .files = ATOMIC_INIT(0), |
| 59 | .sigpending = ATOMIC_INIT(0), | 59 | .sigpending = ATOMIC_INIT(0), |
| 60 | .locked_shm = 0, | 60 | .locked_shm = 0, |
| 61 | .user_ns = &init_user_ns, | 61 | ._user_ns = &init_user_ns, |
| 62 | }; | 62 | }; |
| 63 | 63 | ||
| 64 | /* | 64 | /* |
| @@ -72,7 +72,7 @@ static void uid_hash_insert(struct user_struct *up, struct hlist_head *hashent) | |||
| 72 | static void uid_hash_remove(struct user_struct *up) | 72 | static void uid_hash_remove(struct user_struct *up) |
| 73 | { | 73 | { |
| 74 | hlist_del_init(&up->uidhash_node); | 74 | hlist_del_init(&up->uidhash_node); |
| 75 | put_user_ns(up->user_ns); | 75 | put_user_ns(up->_user_ns); /* It is safe to free the uid hash table now */ |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | static struct user_struct *uid_hash_find(uid_t uid, struct hlist_head *hashent) | 78 | 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 | new->uid = uid; | 153 | new->uid = uid; |
| 154 | atomic_set(&new->__count, 1); | 154 | atomic_set(&new->__count, 1); |
| 155 | 155 | ||
| 156 | new->user_ns = get_user_ns(ns); | 156 | new->_user_ns = get_user_ns(ns); |
| 157 | 157 | ||
| 158 | /* | 158 | /* |
| 159 | * Before adding this, check whether we raced | 159 | * Before adding this, check whether we raced |
