diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-03-07 14:08:40 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-03-07 14:08:40 -0500 |
commit | e9720acd728a46cb40daa52c99a979f7c4ff195c (patch) | |
tree | 01380f601384cf93f30dedb64afe80359fecb807 /include/linux/proc_fs.h | |
parent | 1ff82fe0024e8070c38346b8abc1ff09612dea4c (diff) |
[NET]: Make /proc/net a symlink on /proc/self/net (v3)
Current /proc/net is done with so called "shadows", but current
implementation is broken and has little chances to get fixed.
The problem is that dentries subtree of /proc/net directory has
fancy revalidation rules to make processes living in different
net namespaces see different entries in /proc/net subtree, but
currently, tasks see in the /proc/net subdir the contents of any
other namespace, depending on who opened the file first.
The proposed fix is to turn /proc/net into a symlink, which points
to /proc/self/net, which in turn shows what previously was in
/proc/net - the network-related info, from the net namespace the
appropriate task lives in.
# ls -l /proc/net
lrwxrwxrwx 1 root root 8 Mar 5 15:17 /proc/net -> self/net
In other words - this behaves like /proc/mounts, but unlike
"mounts", "net" is not a file, but a directory.
Changes from v2:
* Fixed discrepancy of /proc/net nlink count and selinux labeling
screwup pointed out by Stephen.
To get the correct nlink count the ->getattr callback for /proc/net
is overridden to read one from the net->proc_net entry.
To make selinux still work the net->proc_net entry is initialized
properly, i.e. with the "net" name and the proc_net parent.
Selinux fixes are
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Changes from v1:
* Fixed a task_struct leak in get_proc_task_net, pointed out by Paul.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/proc_fs.h')
-rw-r--r-- | include/linux/proc_fs.h | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index d9a9e718ad19..9b6c935f69cf 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
@@ -50,8 +50,6 @@ typedef int (read_proc_t)(char *page, char **start, off_t off, | |||
50 | typedef int (write_proc_t)(struct file *file, const char __user *buffer, | 50 | typedef int (write_proc_t)(struct file *file, const char __user *buffer, |
51 | unsigned long count, void *data); | 51 | unsigned long count, void *data); |
52 | typedef int (get_info_t)(char *, char **, off_t, int); | 52 | typedef int (get_info_t)(char *, char **, off_t, int); |
53 | typedef struct proc_dir_entry *(shadow_proc_t)(struct task_struct *task, | ||
54 | struct proc_dir_entry *pde); | ||
55 | 53 | ||
56 | struct proc_dir_entry { | 54 | struct proc_dir_entry { |
57 | unsigned int low_ino; | 55 | unsigned int low_ino; |
@@ -82,7 +80,6 @@ struct proc_dir_entry { | |||
82 | int pde_users; /* number of callers into module in progress */ | 80 | int pde_users; /* number of callers into module in progress */ |
83 | spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */ | 81 | spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */ |
84 | struct completion *pde_unload_completion; | 82 | struct completion *pde_unload_completion; |
85 | shadow_proc_t *shadow_proc; | ||
86 | }; | 83 | }; |
87 | 84 | ||
88 | struct kcore_list { | 85 | struct kcore_list { |