<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/net/ipv4/ip_gre.c, branch linux-2.6.37.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.37.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.37.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2011-03-14T21:17:37Z</updated>
<entry>
<title>net: don't allow CAP_NET_ADMIN to load non-netdev kernel modules</title>
<updated>2011-03-14T21:17:37Z</updated>
<author>
<name>Vasiliy Kulikov</name>
</author>
<published>2011-03-01T21:33:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8767008a7160188deb1e653d5dcaa630b16234b9'/>
<id>urn:sha1:8767008a7160188deb1e653d5dcaa630b16234b9</id>
<content type='text'>
commit 8909c9ad8ff03611c9c96c9a92656213e4bb495b upstream.

Since a8f80e8ff94ecba629542d9b4b5f5a8ee3eb565c any process with
CAP_NET_ADMIN may load any module from /lib/modules/.  This doesn't mean
that CAP_NET_ADMIN is a superset of CAP_SYS_MODULE as modules are
limited to /lib/modules/**.  However, CAP_NET_ADMIN capability shouldn't
allow anybody load any module not related to networking.

This patch restricts an ability of autoloading modules to netdev modules
with explicit aliases.  This fixes CVE-2011-1019.

Arnd Bergmann suggested to leave untouched the old pre-v2.6.32 behavior
of loading netdev modules by name (without any prefix) for processes
with CAP_SYS_MODULE to maintain the compatibility with network scripts
that use autoloading netdev modules by aliases like "eth0", "wlan0".

Currently there are only three users of the feature in the upstream
kernel: ipip, ip_gre and sit.

    root@albatros:~# capsh --drop=$(seq -s, 0 11),$(seq -s, 13 34) --
    root@albatros:~# grep Cap /proc/$$/status
    CapInh:	0000000000000000
    CapPrm:	fffffff800001000
    CapEff:	fffffff800001000
    CapBnd:	fffffff800001000
    root@albatros:~# modprobe xfs
    FATAL: Error inserting xfs
    (/lib/modules/2.6.38-rc6-00001-g2bf4ca3/kernel/fs/xfs/xfs.ko): Operation not permitted
    root@albatros:~# lsmod | grep xfs
    root@albatros:~# ifconfig xfs
    xfs: error fetching interface information: Device not found
    root@albatros:~# lsmod | grep xfs
    root@albatros:~# lsmod | grep sit
    root@albatros:~# ifconfig sit
    sit: error fetching interface information: Device not found
    root@albatros:~# lsmod | grep sit
    root@albatros:~# ifconfig sit0
    sit0      Link encap:IPv6-in-IPv4
	      NOARP  MTU:1480  Metric:1

    root@albatros:~# lsmod | grep sit
    sit                    10457  0
    tunnel4                 2957  1 sit

For CAP_SYS_MODULE module loading is still relaxed:

    root@albatros:~# grep Cap /proc/$$/status
    CapInh:	0000000000000000
    CapPrm:	ffffffffffffffff
    CapEff:	ffffffffffffffff
    CapBnd:	ffffffffffffffff
    root@albatros:~# ifconfig xfs
    xfs: error fetching interface information: Device not found
    root@albatros:~# lsmod | grep xfs
    xfs                   745319  0

Reference: https://lkml.org/lkml/2011/2/24/203

Signed-off-by: Vasiliy Kulikov &lt;segoon@openwall.com&gt;
Signed-off-by: Michael Tokarev &lt;mjt@tls.msk.ru&gt;
Acked-by: David S. Miller &lt;davem@davemloft.net&gt;
Acked-by: Kees Cook &lt;kees.cook@canonical.com&gt;
Signed-off-by: James Morris &lt;jmorris@namei.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>ip_gre: fix fallback tunnel setup</title>
<updated>2010-10-30T23:21:28Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2010-10-30T23:21:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3285ee3bb2e158299ff19b947e41da735980d954'/>
<id>urn:sha1:3285ee3bb2e158299ff19b947e41da735980d954</id>
<content type='text'>
Before making the fallback tunnel visible to lookups, we should make
sure it is completely setup, once ipgre_tunnel_init() had been called
and tstats per_cpu pointer allocated.

move rcu_assign_pointer(ign-&gt;tunnels_wc[0], tunnel); from
ipgre_fb_tunnel_init() to ipgre_init_net()

Based on a patch from Pavel Emelyanov

Reported-by: Pavel Emelyanov &lt;xemul@openvz.org&gt;
Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Acked-by: Pavel Emelyanov &lt;xemul@openvz.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tunnels: Fix tunnels change rcu protection</title>
<updated>2010-10-27T21:20:08Z</updated>
<author>
<name>Pavel Emelyanov</name>
</author>
<published>2010-10-27T05:43:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=74b0b85b88aaa952023762e0280799aaae849841'/>
<id>urn:sha1:74b0b85b88aaa952023762e0280799aaae849841</id>
<content type='text'>
After making rcu protection for tunnels (ipip, gre, sit and ip6) a bug
was introduced into the SIOCCHGTUNNEL code.

The tunnel is first unlinked, then addresses change, then it is linked
back probably into another bucket. But while changing the parms, the
hash table is unlocked to readers and they can lookup the improper tunnel.

Respective commits are b7285b79 (ipip: get rid of ipip_lock), 1507850b
(gre: get rid of ipgre_lock), 3a43be3c (sit: get rid of ipip6_lock) and
94767632 (ip6tnl: get rid of ip6_tnl_lock).

The quick fix is to wait for quiescent state to pass after unlinking,
but if it is inappropriate I can invent something better, just let me
know.

Signed-off-by: Pavel Emelyanov &lt;xemul@openvz.org&gt;
Acked-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>inet: RCU changes in inetdev_by_index()</title>
<updated>2010-10-19T10:50:48Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2010-10-19T00:39:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8723e1b4ad9be4444423b4d41509ce859a629649'/>
<id>urn:sha1:8723e1b4ad9be4444423b4d41509ce859a629649</id>
<content type='text'>
Convert inetdev_by_index() to not increment in_dev refcount.

Callers hold RCU or RTNL, and should not decrement in_dev refcount.

Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: add a core netdev-&gt;rx_dropped counter</title>
<updated>2010-10-05T21:47:55Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2010-09-30T21:06:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=caf586e5f23cebb2a68cbaf288d59dbbf2d74052'/>
<id>urn:sha1:caf586e5f23cebb2a68cbaf288d59dbbf2d74052</id>
<content type='text'>
In various situations, a device provides a packet to our stack and we
drop it before it enters protocol stack :
- softnet backlog full (accounted in /proc/net/softnet_stat)
- bad vlan tag (not accounted)
- unknown/unregistered protocol (not accounted)

We can handle a per-device counter of such dropped frames at core level,
and automatically adds it to the device provided stats (rx_dropped), so
that standard tools can be used (ifconfig, ip link, cat /proc/net/dev)

This is a generalization of commit 8990f468a (net: rx_dropped
accounting), thus reverting it.

Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ip_gre: comments change</title>
<updated>2010-09-30T06:35:10Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2010-09-30T06:35:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6d0722a2cec2c23db3b0855ff8bb433175a16b44'/>
<id>urn:sha1:6d0722a2cec2c23db3b0855ff8bb433175a16b44</id>
<content type='text'>
HARD_TX_LOCK no longer protects tunnels from dead loops,
but xmit_recursion percpu counter.

Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ip_gre: lockless xmit</title>
<updated>2010-09-29T20:25:38Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2010-09-27T23:05:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b790e01aee74c23a5d92576177934f13aa51f718'/>
<id>urn:sha1:b790e01aee74c23a5d92576177934f13aa51f718</id>
<content type='text'>
GRE tunnels can benefit from lockless xmits, using NETIF_F_LLTX

Note: If tunnels are created with the "oseq" option, LLTX is not
enabled :

Even using an atomic_t o_seq, we would increase chance for packets being
out of order at receiver.

Bench on a 16 cpus machine (dual E5540 cpus), 16 threads sending
10000000 UDP frames via one gre tunnel (size:200 bytes per frame)

Before patch :
real	3m0.094s
user	0m9.365s
sys	47m50.103s

After patch:
real	0m29.756s
user	0m11.097s
sys	7m33.012s

Last problem to solve is the contention on dst :

38660.00 21.4% __ip_route_output_key          vmlinux
20786.00 11.5% dst_release                    vmlinux
14191.00  7.8% __xfrm_lookup                  vmlinux
12410.00  6.9% ip_finish_output               vmlinux
 4540.00  2.5% ip_push_pending_frames         vmlinux
 4427.00  2.4% ip_append_data                 vmlinux
 4265.00  2.4% __alloc_skb                    vmlinux
 4140.00  2.3% __ip_local_out                 vmlinux
 3991.00  2.2% dev_queue_xmit                 vmlinux

Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ip_gre: percpu stats accounting</title>
<updated>2010-09-28T04:30:43Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2010-09-27T03:57:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e985aad723d7709e6bee566bacb100d33d9b791b'/>
<id>urn:sha1:e985aad723d7709e6bee566bacb100d33d9b791b</id>
<content type='text'>
Le lundi 27 septembre 2010 à 14:29 +0100, Ben Hutchings a écrit :

&gt; &gt; diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
&gt; &gt; index 5d6ddcb..de39b22 100644
&gt; &gt; --- a/net/ipv4/ip_gre.c
&gt; &gt; +++ b/net/ipv4/ip_gre.c
&gt; [...]
&gt; &gt; @@ -377,7 +405,7 @@ static struct ip_tunnel *ipgre_tunnel_locate(struct net *net,
&gt; &gt;  	if (parms-&gt;name[0])
&gt; &gt;  		strlcpy(name, parms-&gt;name, IFNAMSIZ);
&gt; &gt;  	else
&gt; &gt; -		sprintf(name, "gre%%d");
&gt; &gt; +		strcpy(name, "gre%d");
&gt; &gt;
&gt; &gt;  	dev = alloc_netdev(sizeof(*t), name, ipgre_tunnel_setup);
&gt; &gt;  	if (!dev)
&gt; [...]
&gt;
&gt; This is a valid fix, but doesn't belong in this patch!
&gt;

Sorry ? It was not a fix, but at most a cleanup ;)

Anyway I forgot the gretap case...

[PATCH 2/4 v2] ip_gre: percpu stats accounting

Maintain per_cpu tx_bytes, tx_packets, rx_bytes, rx_packets.

Other seldom used fields are kept in netdev-&gt;stats structure, possibly
unsafe.

This is a preliminary work to support lockless transmit path, and
correct RX stats, that are already unsafe.

Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6</title>
<updated>2010-09-27T08:03:03Z</updated>
<author>
<name>David S. Miller</name>
</author>
<published>2010-09-27T08:03:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e40051d134f7ee95c8c1f7a3471e84eafc9ab326'/>
<id>urn:sha1:e40051d134f7ee95c8c1f7a3471e84eafc9ab326</id>
<content type='text'>
Conflicts:
	drivers/net/qlcnic/qlcnic_init.c
	net/ipv4/ip_output.c
</content>
</entry>
<entry>
<title>net: return operator cleanup</title>
<updated>2010-09-23T21:33:39Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2010-09-22T20:43:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a02cec2155fbea457eca8881870fd2de1a4c4c76'/>
<id>urn:sha1:a02cec2155fbea457eca8881870fd2de1a4c4c76</id>
<content type='text'>
Change "return (EXPR);" to "return EXPR;"

return is not a function, parentheses are not required.

Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
