diff options
| author | Eric W. Biederman <ebiederm@xmission.com> | 2012-05-24 03:10:10 -0400 |
|---|---|---|
| committer | Eric W. Biederman <ebiederm@xmission.com> | 2012-08-15 00:48:06 -0400 |
| commit | a7cb5a49bf64ba64864ae16a6be028f8b0d3cc06 (patch) | |
| tree | 0874310cc4af6cd0193e15058cb9ff9e7a955065 | |
| parent | adb37c4c67f807f16beb222028fb3ce9a354dc2b (diff) | |
userns: Print out socket uids in a user namespace aware fashion.
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: James Morris <jmorris@namei.org>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Cc: Patrick McHardy <kaber@trash.net>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Sridhar Samudrala <sri@us.ibm.com>
Acked-by: Vlad Yasevich <vyasevich@gmail.com>
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
| -rw-r--r-- | include/net/tcp.h | 3 | ||||
| -rw-r--r-- | init/Kconfig | 6 | ||||
| -rw-r--r-- | net/appletalk/atalk_proc.c | 3 | ||||
| -rw-r--r-- | net/ipv4/ping.c | 4 | ||||
| -rw-r--r-- | net/ipv4/raw.c | 4 | ||||
| -rw-r--r-- | net/ipv4/tcp_ipv4.c | 6 | ||||
| -rw-r--r-- | net/ipv4/udp.c | 4 | ||||
| -rw-r--r-- | net/ipv6/raw.c | 3 | ||||
| -rw-r--r-- | net/ipv6/tcp_ipv6.c | 6 | ||||
| -rw-r--r-- | net/ipv6/udp.c | 3 | ||||
| -rw-r--r-- | net/ipx/ipx_proc.c | 3 | ||||
| -rw-r--r-- | net/key/af_key.c | 2 | ||||
| -rw-r--r-- | net/llc/llc_proc.c | 2 | ||||
| -rw-r--r-- | net/packet/af_packet.c | 2 | ||||
| -rw-r--r-- | net/phonet/socket.c | 6 | ||||
| -rw-r--r-- | net/sctp/proc.c | 6 |
16 files changed, 36 insertions, 27 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index e19124b84cd2..91e746736a8f 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
| @@ -1509,7 +1509,8 @@ struct tcp_iter_state { | |||
| 1509 | sa_family_t family; | 1509 | sa_family_t family; |
| 1510 | enum tcp_seq_states state; | 1510 | enum tcp_seq_states state; |
| 1511 | struct sock *syn_wait_sk; | 1511 | struct sock *syn_wait_sk; |
| 1512 | int bucket, offset, sbucket, num, uid; | 1512 | int bucket, offset, sbucket, num; |
| 1513 | kuid_t uid; | ||
| 1513 | loff_t last_pos; | 1514 | loff_t last_pos; |
| 1514 | }; | 1515 | }; |
| 1515 | 1516 | ||
diff --git a/init/Kconfig b/init/Kconfig index 80fae193e3a1..25a6ebb50c64 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
| @@ -942,10 +942,7 @@ config UIDGID_CONVERTED | |||
| 942 | depends on PROC_EVENTS = n | 942 | depends on PROC_EVENTS = n |
| 943 | 943 | ||
| 944 | # Networking | 944 | # Networking |
| 945 | depends on PACKET = n | ||
| 946 | depends on NET_9P = n | 945 | depends on NET_9P = n |
| 947 | depends on IPX = n | ||
| 948 | depends on PHONET = n | ||
| 949 | depends on NET_CLS_FLOW = n | 946 | depends on NET_CLS_FLOW = n |
| 950 | depends on NETFILTER_XT_MATCH_OWNER = n | 947 | depends on NETFILTER_XT_MATCH_OWNER = n |
| 951 | depends on NETFILTER_XT_MATCH_RECENT = n | 948 | depends on NETFILTER_XT_MATCH_RECENT = n |
| @@ -953,14 +950,11 @@ config UIDGID_CONVERTED | |||
| 953 | depends on NETFILTER_NETLINK_LOG = n | 950 | depends on NETFILTER_NETLINK_LOG = n |
| 954 | depends on INET = n | 951 | depends on INET = n |
| 955 | depends on IPV6 = n | 952 | depends on IPV6 = n |
| 956 | depends on IP_SCTP = n | ||
| 957 | depends on AF_RXRPC = n | 953 | depends on AF_RXRPC = n |
| 958 | depends on LLC2 = n | ||
| 959 | depends on NET_KEY = n | 954 | depends on NET_KEY = n |
| 960 | depends on INET_DIAG = n | 955 | depends on INET_DIAG = n |
| 961 | depends on DNS_RESOLVER = n | 956 | depends on DNS_RESOLVER = n |
| 962 | depends on AX25 = n | 957 | depends on AX25 = n |
| 963 | depends on ATALK = n | ||
| 964 | 958 | ||
| 965 | # Filesystems | 959 | # Filesystems |
| 966 | depends on USB_GADGETFS = n | 960 | depends on USB_GADGETFS = n |
diff --git a/net/appletalk/atalk_proc.c b/net/appletalk/atalk_proc.c index b5b1a221c242..c30f3a0717fb 100644 --- a/net/appletalk/atalk_proc.c +++ b/net/appletalk/atalk_proc.c | |||
| @@ -183,7 +183,8 @@ static int atalk_seq_socket_show(struct seq_file *seq, void *v) | |||
| 183 | ntohs(at->dest_net), at->dest_node, at->dest_port, | 183 | ntohs(at->dest_net), at->dest_node, at->dest_port, |
| 184 | sk_wmem_alloc_get(s), | 184 | sk_wmem_alloc_get(s), |
| 185 | sk_rmem_alloc_get(s), | 185 | sk_rmem_alloc_get(s), |
| 186 | s->sk_state, SOCK_INODE(s->sk_socket)->i_uid); | 186 | s->sk_state, |
| 187 | from_kuid_munged(seq_user_ns(seq), sock_i_uid(s))); | ||
| 187 | out: | 188 | out: |
| 188 | return 0; | 189 | return 0; |
| 189 | } | 190 | } |
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index 6232d476f37e..bee5eeb676f8 100644 --- a/net/ipv4/ping.c +++ b/net/ipv4/ping.c | |||
| @@ -845,7 +845,9 @@ static void ping_format_sock(struct sock *sp, struct seq_file *f, | |||
| 845 | bucket, src, srcp, dest, destp, sp->sk_state, | 845 | bucket, src, srcp, dest, destp, sp->sk_state, |
| 846 | sk_wmem_alloc_get(sp), | 846 | sk_wmem_alloc_get(sp), |
| 847 | sk_rmem_alloc_get(sp), | 847 | sk_rmem_alloc_get(sp), |
| 848 | 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp), | 848 | 0, 0L, 0, |
| 849 | from_kuid_munged(seq_user_ns(f), sock_i_uid(sp)), | ||
| 850 | 0, sock_i_ino(sp), | ||
| 849 | atomic_read(&sp->sk_refcnt), sp, | 851 | atomic_read(&sp->sk_refcnt), sp, |
| 850 | atomic_read(&sp->sk_drops), len); | 852 | atomic_read(&sp->sk_drops), len); |
| 851 | } | 853 | } |
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index ff0f071969ea..f2425785d40a 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
| @@ -992,7 +992,9 @@ static void raw_sock_seq_show(struct seq_file *seq, struct sock *sp, int i) | |||
| 992 | i, src, srcp, dest, destp, sp->sk_state, | 992 | i, src, srcp, dest, destp, sp->sk_state, |
| 993 | sk_wmem_alloc_get(sp), | 993 | sk_wmem_alloc_get(sp), |
| 994 | sk_rmem_alloc_get(sp), | 994 | sk_rmem_alloc_get(sp), |
| 995 | 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp), | 995 | 0, 0L, 0, |
| 996 | from_kuid_munged(seq_user_ns(seq), sock_i_uid(sp)), | ||
| 997 | 0, sock_i_ino(sp), | ||
| 996 | atomic_read(&sp->sk_refcnt), sp, atomic_read(&sp->sk_drops)); | 998 | atomic_read(&sp->sk_refcnt), sp, atomic_read(&sp->sk_drops)); |
| 997 | } | 999 | } |
| 998 | 1000 | ||
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 42b2a6a73092..642be8a4c6a3 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
| @@ -2382,7 +2382,7 @@ void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo) | |||
| 2382 | EXPORT_SYMBOL(tcp_proc_unregister); | 2382 | EXPORT_SYMBOL(tcp_proc_unregister); |
| 2383 | 2383 | ||
| 2384 | static void get_openreq4(const struct sock *sk, const struct request_sock *req, | 2384 | static void get_openreq4(const struct sock *sk, const struct request_sock *req, |
| 2385 | struct seq_file *f, int i, int uid, int *len) | 2385 | struct seq_file *f, int i, kuid_t uid, int *len) |
| 2386 | { | 2386 | { |
| 2387 | const struct inet_request_sock *ireq = inet_rsk(req); | 2387 | const struct inet_request_sock *ireq = inet_rsk(req); |
| 2388 | int ttd = req->expires - jiffies; | 2388 | int ttd = req->expires - jiffies; |
| @@ -2399,7 +2399,7 @@ static void get_openreq4(const struct sock *sk, const struct request_sock *req, | |||
| 2399 | 1, /* timers active (only the expire timer) */ | 2399 | 1, /* timers active (only the expire timer) */ |
| 2400 | jiffies_to_clock_t(ttd), | 2400 | jiffies_to_clock_t(ttd), |
| 2401 | req->retrans, | 2401 | req->retrans, |
| 2402 | uid, | 2402 | from_kuid_munged(seq_user_ns(f), uid), |
| 2403 | 0, /* non standard timer */ | 2403 | 0, /* non standard timer */ |
| 2404 | 0, /* open_requests have no inode */ | 2404 | 0, /* open_requests have no inode */ |
| 2405 | atomic_read(&sk->sk_refcnt), | 2405 | atomic_read(&sk->sk_refcnt), |
| @@ -2450,7 +2450,7 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i, int *len) | |||
| 2450 | timer_active, | 2450 | timer_active, |
| 2451 | jiffies_to_clock_t(timer_expires - jiffies), | 2451 | jiffies_to_clock_t(timer_expires - jiffies), |
| 2452 | icsk->icsk_retransmits, | 2452 | icsk->icsk_retransmits, |
| 2453 | sock_i_uid(sk), | 2453 | from_kuid_munged(seq_user_ns(f), sock_i_uid(sk)), |
| 2454 | icsk->icsk_probes_out, | 2454 | icsk->icsk_probes_out, |
| 2455 | sock_i_ino(sk), | 2455 | sock_i_ino(sk), |
| 2456 | atomic_read(&sk->sk_refcnt), sk, | 2456 | atomic_read(&sk->sk_refcnt), sk, |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index b4c3582a991f..53b89817c008 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
| @@ -2110,7 +2110,9 @@ static void udp4_format_sock(struct sock *sp, struct seq_file *f, | |||
| 2110 | bucket, src, srcp, dest, destp, sp->sk_state, | 2110 | bucket, src, srcp, dest, destp, sp->sk_state, |
| 2111 | sk_wmem_alloc_get(sp), | 2111 | sk_wmem_alloc_get(sp), |
| 2112 | sk_rmem_alloc_get(sp), | 2112 | sk_rmem_alloc_get(sp), |
| 2113 | 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp), | 2113 | 0, 0L, 0, |
| 2114 | from_kuid_munged(seq_user_ns(f), sock_i_uid(sp)), | ||
| 2115 | 0, sock_i_ino(sp), | ||
| 2114 | atomic_read(&sp->sk_refcnt), sp, | 2116 | atomic_read(&sp->sk_refcnt), sp, |
| 2115 | atomic_read(&sp->sk_drops), len); | 2117 | atomic_read(&sp->sk_drops), len); |
| 2116 | } | 2118 | } |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index ef0579d5bca6..7af88ef01657 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
| @@ -1251,7 +1251,8 @@ static void raw6_sock_seq_show(struct seq_file *seq, struct sock *sp, int i) | |||
| 1251 | sk_wmem_alloc_get(sp), | 1251 | sk_wmem_alloc_get(sp), |
| 1252 | sk_rmem_alloc_get(sp), | 1252 | sk_rmem_alloc_get(sp), |
| 1253 | 0, 0L, 0, | 1253 | 0, 0L, 0, |
| 1254 | sock_i_uid(sp), 0, | 1254 | from_kuid_munged(seq_user_ns(seq), sock_i_uid(sp)), |
| 1255 | 0, | ||
| 1255 | sock_i_ino(sp), | 1256 | sock_i_ino(sp), |
| 1256 | atomic_read(&sp->sk_refcnt), sp, atomic_read(&sp->sk_drops)); | 1257 | atomic_read(&sp->sk_refcnt), sp, atomic_read(&sp->sk_drops)); |
| 1257 | } | 1258 | } |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index c66b90f71c9b..4b5b335ebde1 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
| @@ -1803,7 +1803,7 @@ static void tcp_v6_destroy_sock(struct sock *sk) | |||
| 1803 | #ifdef CONFIG_PROC_FS | 1803 | #ifdef CONFIG_PROC_FS |
| 1804 | /* Proc filesystem TCPv6 sock list dumping. */ | 1804 | /* Proc filesystem TCPv6 sock list dumping. */ |
| 1805 | static void get_openreq6(struct seq_file *seq, | 1805 | static void get_openreq6(struct seq_file *seq, |
| 1806 | const struct sock *sk, struct request_sock *req, int i, int uid) | 1806 | const struct sock *sk, struct request_sock *req, int i, kuid_t uid) |
| 1807 | { | 1807 | { |
| 1808 | int ttd = req->expires - jiffies; | 1808 | int ttd = req->expires - jiffies; |
