History

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.

Eric W. Biederman committed 15 years ago

Commit d0bd6591 parent 6f9ac6d2 files · +4 −4Browse files

Unified · Split

2 files
  1. include/linux/sched.h +1 −1
  2. kernel/user.c +3 −3
include/linux/sched.h+1−1
@@ -729,7 +729,7 @@ struct user_struct { · 728 unmodified lines
729729 /* Hash table maintenance information */
730730 struct hlist_node uidhash_node;
731731 uid_t uid;
732− struct user_namespace *user_ns;
732+ struct user_namespace *_user_ns; /* Don't use will be removed soon */
733733
734734 #ifdef CONFIG_PERF_EVENTS
735735 atomic_long_t locked_vm;
kernel/user.c+3−3
@@ -58,7 +58,7 @@ struct user_struct root_user = { · 57 unmodified lines
5858 .files = ATOMIC_INIT(0),
5959 .sigpending = ATOMIC_INIT(0),
6060 .locked_shm = 0,
61− .user_ns = &init_user_ns,
61+ ._user_ns = &init_user_ns,
6262 };
6363
6464 /*
@@ -72,7 +72,7 @@ static void uid_hash_insert(struct user_struct *up, struct hlist_head *hashent) · 7 unmodified lines
7272 static void uid_hash_remove(struct user_struct *up)
7373 {
7474 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 */
7676 }
7777
7878 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) · 74 unmodified lines
153153 new->uid = uid;
154154 atomic_set(&new->__count, 1);
155155
156− new->user_ns = get_user_ns(ns);
156+ new->_user_ns = get_user_ns(ns);
157157
158158 /*
159159 * Before adding this, check whether we raced

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t