<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/drivers/net/loopback.c, branch v3.18.48</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.18.48</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.18.48'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2014-10-07T17:22:11Z</updated>
<entry>
<title>net: better IFF_XMIT_DST_RELEASE support</title>
<updated>2014-10-07T17:22:11Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2014-10-06T01:38:35Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=0287587884b15041203b3a362d485e1ab1f24445'/>
<id>urn:sha1:0287587884b15041203b3a362d485e1ab1f24445</id>
<content type='text'>
Testing xmit_more support with netperf and connected UDP sockets,
I found strange dst refcount false sharing.

Current handling of IFF_XMIT_DST_RELEASE is not optimal.

Dropping dst in validate_xmit_skb() is certainly too late in case
packet was queued by cpu X but dequeued by cpu Y

The logical point to take care of drop/force is in __dev_queue_xmit()
before even taking qdisc lock.

As Julian Anastasov pointed out, need for skb_dst() might come from some
packet schedulers or classifiers.

This patch adds new helper to cleanly express needs of various drivers
or qdiscs/classifiers.

Drivers that need skb_dst() in their ndo_start_xmit() should call
following helper in their setup instead of the prior :

	dev-&gt;priv_flags &amp;= ~IFF_XMIT_DST_RELEASE;
-&gt;
	netif_keep_dst(dev);

Instead of using a single bit, we use two bits, one being
eventually rebuilt in bonding/team drivers.

The other one, is permanent and blocks IFF_XMIT_DST_RELEASE being
rebuilt in bonding/team. Eventually, we could add something
smarter later.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Julian Anastasov &lt;ja@ssi.bg&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: set name_assign_type in alloc_netdev()</title>
<updated>2014-07-15T23:12:48Z</updated>
<author>
<name>Tom Gundersen</name>
<email>teg@jklm.no</email>
</author>
<published>2014-07-14T14:37:24Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=c835a677331495cf137a7f8a023463afd9f032f8'/>
<id>urn:sha1:c835a677331495cf137a7f8a023463afd9f032f8</id>
<content type='text'>
Extend alloc_netdev{,_mq{,s}}() to take name_assign_type as argument, and convert
all users to pass NET_NAME_UNKNOWN.

Coccinelle patch:

@@
expression sizeof_priv, name, setup, txqs, rxqs, count;
@@

(
-alloc_netdev_mqs(sizeof_priv, name, setup, txqs, rxqs)
+alloc_netdev_mqs(sizeof_priv, name, NET_NAME_UNKNOWN, setup, txqs, rxqs)
|
-alloc_netdev_mq(sizeof_priv, name, setup, count)
+alloc_netdev_mq(sizeof_priv, name, NET_NAME_UNKNOWN, setup, count)
|
-alloc_netdev(sizeof_priv, name, setup)
+alloc_netdev(sizeof_priv, name, NET_NAME_UNKNOWN, setup)
)

v9: move comments here from the wrong commit

Signed-off-by: Tom Gundersen &lt;teg@jklm.no&gt;
Reviewed-by: David Herrmann &lt;dh.herrmann@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: Replace u64_stats_fetch_begin_bh to u64_stats_fetch_begin_irq</title>
<updated>2014-03-15T02:41:36Z</updated>
<author>
<name>Eric W. Biederman</name>
<email>ebiederm@xmission.com</email>
</author>
<published>2014-03-14T04:26:42Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=57a7744e09867ebcfa0ccf1d6d529caa7728d552'/>
<id>urn:sha1:57a7744e09867ebcfa0ccf1d6d529caa7728d552</id>
<content type='text'>
Replace the bh safe variant with the hard irq safe variant.

We need a hard irq safe variant to deal with netpoll transmitting
packets from hard irq context, and we need it in most if not all of
the places using the bh safe variant.

Except on 32bit uni-processor the code is exactly the same so don't
bother with a bh variant, just have a hard irq safe variant that
everyone can use.

Signed-off-by: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>loopback: sctp: add NETIF_F_SCTP_CSUM to device features</title>
<updated>2014-02-25T00:00:08Z</updated>
<author>
<name>Daniel Borkmann</name>
<email>dborkman@redhat.com</email>
</author>
<published>2014-02-22T13:01:53Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b17c706987fa6f28bdc1771c8266e7a69e22adcb'/>
<id>urn:sha1:b17c706987fa6f28bdc1771c8266e7a69e22adcb</id>
<content type='text'>
Drivers are allowed to set NETIF_F_SCTP_CSUM if they have
hardware crc32c checksumming support for the SCTP protocol.
Currently, NETIF_F_SCTP_CSUM flag is available in igb,
ixgbe, i40e/i40evf drivers and for vlan devices.

If we don't have NETIF_F_SCTP_CSUM then crc32c is done
through CPU instructions, invoked from crypto layer, or
if not available as slow-path fallback in software.

Currently, loopback device propagates checksum offloading
feature flags in dev-&gt;features, but is missing SCTP checksum
offloading. Therefore, account for NETIF_F_SCTP_CSUM as
well.

Before patch:

./netperf_sctp -H 192.168.0.100 -t SCTP_STREAM_MANY
SCTP 1-TO-MANY STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.0.100 () port 0 AF_INET
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

4194304 4194304   4096    10.00    4683.50

After patch:

./netperf_sctp -H 192.168.0.100 -t SCTP_STREAM_MANY
SCTP 1-TO-MANY STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.0.100 () port 0 AF_INET
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

4194304 4194304   4096    10.00    15348.26

Signed-off-by: Daniel Borkmann &lt;dborkman@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: introduce netdev_alloc_pcpu_stats() for drivers</title>
<updated>2014-02-14T20:49:55Z</updated>
<author>
<name>WANG Cong</name>
<email>xiyou.wangcong@gmail.com</email>
</author>
<published>2014-02-13T19:46:28Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=1c213bd24ad04f4430031d20d740d7783162b099'/>
<id>urn:sha1:1c213bd24ad04f4430031d20d740d7783162b099</id>
<content type='text'>
There are many drivers calling alloc_percpu() to allocate pcpu stats
and then initializing -&gt;syncp. So just introduce a helper function for them.

Cc: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Cong Wang &lt;xiyou.wangcong@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: allow setting mac address of loopback device</title>
<updated>2014-02-13T22:46:49Z</updated>
<author>
<name>WANG Cong</name>
<email>xiyou.wangcong@gmail.com</email>
</author>
<published>2014-02-12T01:21:26Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=25f929fbff0d1bcebf2e92656d33025cd330cbf8'/>
<id>urn:sha1:25f929fbff0d1bcebf2e92656d33025cd330cbf8</id>
<content type='text'>
We are trying to mirror the local traffic from lo to eth0,
allowing setting mac address of lo to eth0 would make
the ether addresses in these packets correct, so that
we don't have to modify the ether header again.

Since usually no one cares about its mac address (all-zero),
it is safe to allow those who care to set its mac address.

Cc: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Cc: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Cc: Stephen Hemminger &lt;stephen@networkplumber.org&gt;
Cc: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Cong Wang &lt;xiyou.wangcong@gmail.com&gt;
Acked-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>drivers/net: delete non-required instances of include &lt;linux/init.h&gt;</title>
<updated>2014-01-16T19:53:26Z</updated>
<author>
<name>Paul Gortmaker</name>
<email>paul.gortmaker@windriver.com</email>
</author>
<published>2014-01-08T20:32:47Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a81ab36bf52d0ca3a32251a923be1dbced726141'/>
<id>urn:sha1:a81ab36bf52d0ca3a32251a923be1dbced726141</id>
<content type='text'>
None of these files are actually using any __init type directives
and hence don't need to include &lt;linux/init.h&gt;.   Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

This covers everything under drivers/net except for wireless, which
has been submitted separately.

Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: Explicitly initialize u64_stats_sync structures for lockdep</title>
<updated>2013-11-06T11:40:25Z</updated>
<author>
<name>John Stultz</name>
<email>john.stultz@linaro.org</email>
</author>
<published>2013-10-07T22:51:58Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=827da44c61419f29ae3be198c342e2147f1a10cb'/>
<id>urn:sha1:827da44c61419f29ae3be198c342e2147f1a10cb</id>
<content type='text'>
In order to enable lockdep on seqcount/seqlock structures, we
must explicitly initialize any locks.

The u64_stats_sync structure, uses a seqcount, and thus we need
to introduce a u64_stats_init() function and use it to initialize
the structure.

This unfortunately adds a lot of fairly trivial initialization code
to a number of drivers. But the benefit of ensuring correctness makes
this worth while.

Because these changes are required for lockdep to be enabled, and the
changes are quite trivial, I've not yet split this patch out into 30-some
separate patches, as I figured it would be better to get the various
maintainers thoughts on how to best merge this change along with
the seqcount lockdep enablement.

Feedback would be appreciated!

Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Acked-by: Julian Anastasov &lt;ja@ssi.bg&gt;
Signed-off-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Alexey Kuznetsov &lt;kuznet@ms2.inr.ac.ru&gt;
Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Cc: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: Hideaki YOSHIFUJI &lt;yoshfuji@linux-ipv6.org&gt;
Cc: James Morris &lt;jmorris@namei.org&gt;
Cc: Jesse Gross &lt;jesse@nicira.com&gt;
Cc: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Cc: "Michael S. Tsirkin" &lt;mst@redhat.com&gt;
Cc: Mirko Lindner &lt;mlindner@marvell.com&gt;
Cc: Patrick McHardy &lt;kaber@trash.net&gt;
Cc: Roger Luethi &lt;rl@hellgate.ch&gt;
Cc: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Cc: Simon Horman &lt;horms@verge.net.au&gt;
Cc: Stephen Hemminger &lt;stephen@networkplumber.org&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: Thomas Petazzoni &lt;thomas.petazzoni@free-electrons.com&gt;
Cc: Wensong Zhang &lt;wensong@linux-vs.org&gt;
Cc: netdev@vger.kernel.org
Link: http://lkml.kernel.org/r/1381186321-4906-2-git-send-email-john.stultz@linaro.org
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>net loopback: Set loopback_dev to NULL when freed</title>
<updated>2013-09-17T23:05:13Z</updated>
<author>
<name>Eric W. Biederman</name>
<email>ebiederm@xmission.com</email>
</author>
<published>2013-09-16T23:52:41Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e05e90702b2638a39b5ae9d22740f3a1607c54a0'/>
<id>urn:sha1:e05e90702b2638a39b5ae9d22740f3a1607c54a0</id>
<content type='text'>
It has recently turned up that we have a number of long standing bugs
in the network stack cleanup code with use of the loopback device
after it has been freed that have not turned up because in most cases
the storage allocated to the loopback device is not reused, when those
accesses happen.

Set looback_dev to NULL to trigger oopses instead of silent data corrupt
when we hit this class of bug.

Signed-off-by: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Acked-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: loopback: fix a dst refcounting issue</title>
<updated>2013-01-27T06:30:35Z</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=794ed393b707f01858f5ebe2ae5eabaf89d00022'/>
<id>urn:sha1:794ed393b707f01858f5ebe2ae5eabaf89d00022</id>
<content type='text'>
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;
</content>
</entry>
</feed>
