<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/drivers/net/loopback.c, branch v3.2.64</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.2.64</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.2.64'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2013-02-20T03:15:34Z</updated>
<entry>
<title>net: loopback: fix a dst refcounting issue</title>
<updated>2013-02-20T03:15:34Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2013-01-25T07:44:41Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=7047cf781217e4900c233ded2b3e856d7b894f5a'/>
<id>urn:sha1:7047cf781217e4900c233ded2b3e856d7b894f5a</id>
<content type='text'>
[ Upstream commit 794ed393b707f01858f5ebe2ae5eabaf89d00022 ]

Ben Greear reported crashes in ip_rcv_finish() on a stress
test involving many macvlans.

We tracked the bug to a dst use after free. ip_rcv_finish()
was calling dst-&gt;input() and got garbage for dst-&gt;input value.

It appears the bug is in loopback driver, lacking
a skb_dst_force() before calling netif_rx().

As a result, a non refcounted dst, normally protected by a
RCU read_lock section, was escaping this section and could
be freed before the packet being processed.

  [&lt;ffffffff813a3c4d&gt;] loopback_xmit+0x64/0x83
  [&lt;ffffffff81477364&gt;] dev_hard_start_xmit+0x26c/0x35e
  [&lt;ffffffff8147771a&gt;] dev_queue_xmit+0x2c4/0x37c
  [&lt;ffffffff81477456&gt;] ? dev_hard_start_xmit+0x35e/0x35e
  [&lt;ffffffff8148cfa6&gt;] ? eth_header+0x28/0xb6
  [&lt;ffffffff81480f09&gt;] neigh_resolve_output+0x176/0x1a7
  [&lt;ffffffff814ad835&gt;] ip_finish_output2+0x297/0x30d
  [&lt;ffffffff814ad6d5&gt;] ? ip_finish_output2+0x137/0x30d
  [&lt;ffffffff814ad90e&gt;] ip_finish_output+0x63/0x68
  [&lt;ffffffff814ae412&gt;] ip_output+0x61/0x67
  [&lt;ffffffff814ab904&gt;] dst_output+0x17/0x1b
  [&lt;ffffffff814adb6d&gt;] ip_local_out+0x1e/0x23
  [&lt;ffffffff814ae1c4&gt;] ip_queue_xmit+0x315/0x353
  [&lt;ffffffff814adeaf&gt;] ? ip_send_unicast_reply+0x2cc/0x2cc
  [&lt;ffffffff814c018f&gt;] tcp_transmit_skb+0x7ca/0x80b
  [&lt;ffffffff814c3571&gt;] tcp_connect+0x53c/0x587
  [&lt;ffffffff810c2f0c&gt;] ? getnstimeofday+0x44/0x7d
  [&lt;ffffffff810c2f56&gt;] ? ktime_get_real+0x11/0x3e
  [&lt;ffffffff814c6f9b&gt;] tcp_v4_connect+0x3c2/0x431
  [&lt;ffffffff814d6913&gt;] __inet_stream_connect+0x84/0x287
  [&lt;ffffffff814d6b38&gt;] ? inet_stream_connect+0x22/0x49
  [&lt;ffffffff8108d695&gt;] ? _local_bh_enable_ip+0x84/0x9f
  [&lt;ffffffff8108d6c8&gt;] ? local_bh_enable+0xd/0x11
  [&lt;ffffffff8146763c&gt;] ? lock_sock_nested+0x6e/0x79
  [&lt;ffffffff814d6b38&gt;] ? inet_stream_connect+0x22/0x49
  [&lt;ffffffff814d6b49&gt;] inet_stream_connect+0x33/0x49
  [&lt;ffffffff814632c6&gt;] sys_connect+0x75/0x98

This bug was introduced in linux-2.6.35, in commit
7fee226ad2397b (net: add a noref bit on skb dst)

skb_dst_force() is enforced in dev_queue_xmit() for devices having a
qdisc.

Reported-by: Ben Greear &lt;greearb@candelatech.com&gt;
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Tested-by: Ben Greear &lt;greearb@candelatech.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>net: Allow ethtool to set interface in loopback mode.</title>
<updated>2011-05-08T22:59:12Z</updated>
<author>
<name>Mahesh Bandewar</name>
<email>maheshb@google.com</email>
</author>
<published>2011-05-04T15:30:11Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=eed2a12f1ed9aabf0676f4d0db34aad51976c5c6'/>
<id>urn:sha1:eed2a12f1ed9aabf0676f4d0db34aad51976c5c6</id>
<content type='text'>
This patch enables ethtool to set the loopback mode on a given interface.
By configuring the interface in loopback mode in conjunction with a policy
route / rule, a userland application can stress the egress / ingress path
exposing the flows of the change in progress and potentially help developer(s)
understand the impact of those changes without even sending a packet out
on the network.

Following set of commands illustrates one such example -
    a) ip -4 addr add 192.168.1.1/24 dev eth1
    b) ip -4 rule add from all iif eth1 lookup 250
    c) ip -4 route add local 0/0 dev lo proto kernel scope host table 250
    d) arp -Ds 192.168.1.100 eth1
    e) arp -Ds 192.168.1.200 eth1
    f) sysctl -w net.ipv4.ip_nonlocal_bind=1
    g) sysctl -w net.ipv4.conf.all.accept_local=1
    # Assuming that the machine has 8 cores
    h) taskset 000f netserver -L 192.168.1.200
    i) taskset 00f0 netperf -t TCP_CRR -L 192.168.1.100 -H 192.168.1.200 -l 30

Signed-off-by: Mahesh Bandewar &lt;maheshb@google.com&gt;
Acked-by: Ben Hutchings &lt;bhutchings@solarflare.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ip6_pol_route panic: Do not allow VLAN on loopback</title>
<updated>2011-04-18T06:27:16Z</updated>
<author>
<name>Krishna Kumar</name>
<email>krkumar2@in.ibm.com</email>
</author>
<published>2011-04-14T06:07:04Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=0553c891fabd287726b41076cfd03fe7e5ab596f'/>
<id>urn:sha1:0553c891fabd287726b41076cfd03fe7e5ab596f</id>
<content type='text'>
Several tests in the ipv6 routing code check IFF_LOOPBACK, and
allowing stacking such as VLAN'ing on top of loopback results in a
netdevice which reports IFF_LOOPBACK but really isn't the loopback
device.

Instead of spamming the ipv6 routing code with even more special tests,
simply disallow VLAN over loopback.

The result of this patch is:

# modprobe 8021q
# vconfig add lo 43
ERROR: trying to add VLAN #43 to IF -:lo:-  error: Operation not supported

Signed-off-by: Krishna Kumar &lt;krkumar2@in.ibm.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>loopback: convert to hw_features</title>
<updated>2011-02-17T22:16:35Z</updated>
<author>
<name>Michał Mirosław</name>
<email>mirq-linux@rere.qmqm.pl</email>
</author>
<published>2011-02-15T16:59:18Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=cf0bdefd4676ad4ad59507a058821491a40ec7e6'/>
<id>urn:sha1:cf0bdefd4676ad4ad59507a058821491a40ec7e6</id>
<content type='text'>
This also enables TSOv6, TSO-ECN, and UFO as loopback clearly can handle them.

Signed-off-by: Michał Mirosław &lt;mirq-linux@rere.qmqm.pl&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>
<email>eric.dumazet@gmail.com</email>
</author>
<published>2010-09-30T21:06:55Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.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>net: loopback driver cleanup</title>
<updated>2010-09-27T02:04:08Z</updated>
<author>
<name>Eric Dumazet</name>
<email>eric.dumazet@gmail.com</email>
</author>
<published>2010-09-23T23:51:51Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a7855c78a24d6348e989bec616318e68c662e78b'/>
<id>urn:sha1:a7855c78a24d6348e989bec616318e68c662e78b</id>
<content type='text'>
loopback driver uses dev-&gt;ml_priv to store its percpu stats pointer.
It uses ugly casts "(void __percpu __force *)" to shut up sparse
complains.

Define an union to better document we use ml_priv in loopback driver and
define a lstats field with appropriate types.

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: fix 64 bit counters on 32 bit arches</title>
<updated>2010-07-07T21:58:56Z</updated>
<author>
<name>Eric Dumazet</name>
<email>eric.dumazet@gmail.com</email>
</author>
<published>2010-07-07T21:58:56Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=28172739f0a276eb8d6ca917b3974c2edb036da3'/>
<id>urn:sha1:28172739f0a276eb8d6ca917b3974c2edb036da3</id>
<content type='text'>
There is a small possibility that a reader gets incorrect values on 32
bit arches. SNMP applications could catch incorrect counters when a
32bit high part is changed by another stats consumer/provider.

One way to solve this is to add a rtnl_link_stats64 param to all
ndo_get_stats64() methods, and also add such a parameter to
dev_get_stats().

Rule is that we are not allowed to use dev-&gt;stats64 as a temporary
storage for 64bit stats, but a caller provided area (usually on stack)

Old drivers (only providing get_stats() method) need no changes.

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>loopback: use u64_stats_sync infrastructure</title>
<updated>2010-06-26T04:33:16Z</updated>
<author>
<name>Eric Dumazet</name>
<email>eric.dumazet@gmail.com</email>
</author>
<published>2010-06-22T12:44:11Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5eaa0bd81f93225b6d1972b373ed00ca763052b2'/>
<id>urn:sha1:5eaa0bd81f93225b6d1972b373ed00ca763052b2</id>
<content type='text'>
Commit 6b10de38f0ef (loopback: Implement 64bit stats on 32bit arches)
introduced 64bit stats in loopback driver, using a private seqcount and
private helpers.

David suggested to introduce a generic infrastructure, added in (net:
Introduce u64_stats_sync infrastructure)

This patch reimplements loopback 64bit stats using the u64_stats_sync
infrastructure.

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>loopback: Implement 64bit stats on 32bit arches</title>
<updated>2010-06-15T06:13:07Z</updated>
<author>
<name>Eric Dumazet</name>
<email>eric.dumazet@gmail.com</email>
</author>
<published>2010-06-14T05:59:22Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6b10de38f0ef4e921a1f6e5cba2b6c92d6b46ecd'/>
<id>urn:sha1:6b10de38f0ef4e921a1f6e5cba2b6c92d6b46ecd</id>
<content type='text'>
Uses a seqcount_t to synchronize stat producer and consumer, for packets
and bytes counter, now u64 types.

(dropped counter being rarely used, stay a native "unsigned long" type)

No noticeable performance impact on x86, as it only adds two increments
per frame. It might be more expensive on arches where smp_wmb() is not
free.

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>percpu: add __percpu sparse annotations to net drivers</title>
<updated>2010-02-17T07:05:38Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2010-02-16T15:21:08Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=47d742752df4c1088589d4424840bc761613ab2a'/>
<id>urn:sha1:47d742752df4c1088589d4424840bc761613ab2a</id>
<content type='text'>
Add __percpu sparse annotations to net drivers.

These annotations are to make sparse consider percpu variables to be
in a different address space and warn if accessed without going
through percpu accessors.  This patch doesn't affect normal builds.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Acked-by: David S. Miller &lt;davem@davemloft.net&gt;
Cc: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
