diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2011-06-15 13:21:48 -0400 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2012-11-20 07:19:49 -0500 |
commit | 98f842e675f96ffac96e6c50315790912b2812be (patch) | |
tree | ed4dee9a6e54e3443e9f3f1614c8a2fcf9b31e0a /include/linux/proc_fs.h | |
parent | bf056bfa80596a5d14b26b17276a56a0dcb080e5 (diff) |
proc: Usable inode numbers for the namespace file descriptors.
Assign a unique proc inode to each namespace, and use that
inode number to ensure we only allocate at most one proc
inode for every namespace in proc.
A single proc inode per namespace allows userspace to test
to see if two processes are in the same namespace.
This has been a long requested feature and only blocked because
a naive implementation would put the id in a global space and
would ultimately require having a namespace for the names of
namespaces, making migration and certain virtualization tricks
impossible.
We still don't have per superblock inode numbers for proc, which
appears necessary for application unaware checkpoint/restart and
migrations (if the application is using namespace file descriptors)
but that is now allowd by the design if it becomes important.
I have preallocated the ipc and uts initial proc inode numbers so
their structures can be statically initialized.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'include/linux/proc_fs.h')
-rw-r--r-- | include/linux/proc_fs.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index bf1d000fbba..2e24018b7ce 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
@@ -28,7 +28,11 @@ struct mm_struct; | |||
28 | */ | 28 | */ |
29 | 29 | ||
30 | enum { | 30 | enum { |
31 | PROC_ROOT_INO = 1, | 31 | PROC_ROOT_INO = 1, |
32 | PROC_IPC_INIT_INO = 0xEFFFFFFFU, | ||
33 | PROC_UTS_INIT_INO = 0xEFFFFFFEU, | ||
34 | PROC_USER_INIT_INO = 0xEFFFFFFDU, | ||
35 | PROC_PID_INIT_INO = 0xEFFFFFFCU, | ||
32 | }; | 36 | }; |
33 | 37 | ||
34 | /* | 38 | /* |
@@ -263,6 +267,7 @@ struct proc_ns_operations { | |||
263 | void *(*get)(struct task_struct *task); | 267 | void *(*get)(struct task_struct *task); |
264 | void (*put)(void *ns); | 268 | void (*put)(void *ns); |
265 | int (*install)(struct nsproxy *nsproxy, void *ns); | 269 | int (*install)(struct nsproxy *nsproxy, void *ns); |
270 | unsigned int (*inum)(void *ns); | ||
266 | }; | 271 | }; |
267 | extern const struct proc_ns_operations netns_operations; | 272 | extern const struct proc_ns_operations netns_operations; |
268 | extern const struct proc_ns_operations utsns_operations; | 273 | extern const struct proc_ns_operations utsns_operations; |