kernel-ark/fs/proc
Pavel Emelyanov e9720acd72 [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>
2008-03-07 11:08:40 -08:00
..
array.c proc: seqfile convert proc_pid_status to properly handle pid namespaces 2008-02-08 09:22:24 -08:00
base.c [NET]: Make /proc/net a symlink on /proc/self/net (v3) 2008-03-07 11:08:40 -08:00
generic.c [NET]: Make /proc/net a symlink on /proc/self/net (v3) 2008-03-07 11:08:40 -08:00
inode-alloc.txt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
inode.c proc: remove MODULE_LICENSE 2008-02-08 09:22:23 -08:00
internal.h [NET]: Make /proc/net a symlink on /proc/self/net (v3) 2008-03-07 11:08:40 -08:00
kcore.c aout: remove unnecessary inclusions of {asm, linux}/a.out.h 2008-02-08 09:22:30 -08:00
kmsg.c [PATCH] Make most file operations structs in fs/ const 2006-03-28 09:16:06 -08:00
Makefile [NET]: Make /proc/net per network namespace 2007-10-10 16:49:06 -07:00
mmu.c fs/proc/mmu.c: headers butchery 2007-10-17 08:42:48 -07:00
nommu.c d_path: Make seq_path() use a struct path argument 2008-02-14 21:17:08 -08:00
proc_devtree.c [POWERPC] Make struct property's value a void * 2007-04-13 03:55:18 +10:00
proc_misc.c procfs: constify function pointer tables 2008-02-08 09:22:38 -08:00
proc_net.c [NET]: Make /proc/net a symlink on /proc/self/net (v3) 2008-03-07 11:08:40 -08:00
proc_sysctl.c Embed a struct path into struct nameidata instead of nd->{dentry,mnt} 2008-02-14 21:13:33 -08:00
proc_tty.c procfs: constify function pointer tables 2008-02-08 09:22:38 -08:00
root.c proc: fix ->open'less usage due to ->proc_fops flip 2008-02-08 09:22:24 -08:00
task_mmu.c /proc/pid/pagemap: fix PM_SPECIAL macro 2008-02-23 17:12:13 -08:00
task_nommu.c d_path: Make proc_get_link() use a struct path argument 2008-02-14 21:17:08 -08:00
vmcore.c aout: remove unnecessary inclusions of {asm, linux}/a.out.h 2008-02-08 09:22:30 -08:00