<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/net/core, branch v4.0</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.0</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.0'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2015-04-06T20:12:49Z</updated>
<entry>
<title>ipv6: protect skb-&gt;sk accesses from recursive dereference inside the stack</title>
<updated>2015-04-06T20:12:49Z</updated>
<author>
<name>hannes@stressinduktion.org</name>
<email>hannes@stressinduktion.org</email>
</author>
<published>2015-04-01T15:07:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f60e5990d9c1424af9dbca60a23ba2a1c7c1ce90'/>
<id>urn:sha1:f60e5990d9c1424af9dbca60a23ba2a1c7c1ce90</id>
<content type='text'>
We should not consult skb-&gt;sk for output decisions in xmit recursion
levels &gt; 0 in the stack. Otherwise local socket settings could influence
the result of e.g. tunnel encapsulation process.

ipv6 does not conform with this in three places:

1) ip6_fragment: we do consult ipv6_npinfo for frag_size

2) sk_mc_loop in ipv6 uses skb-&gt;sk and checks if we should
   loop the packet back to the local socket

3) ip6_skb_dst_mtu could query the settings from the user socket and
   force a wrong MTU

Furthermore:
In sk_mc_loop we could potentially land in WARN_ON(1) if we use a
PF_PACKET socket ontop of an IPv6-backed vxlan device.

Reuse xmit_recursion as we are currently only interested in protecting
tunnel devices.

Cc: Jiri Pirko &lt;jiri@resnulli.us&gt;
Signed-off-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netns: don't allocate an id for dead netns</title>
<updated>2015-04-03T16:36:31Z</updated>
<author>
<name>Nicolas Dichtel</name>
<email>nicolas.dichtel@6wind.com</email>
</author>
<published>2015-04-03T10:02:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=576b7cd2f6ff1e90b3fc0a000d2fe74f8a50a4bb'/>
<id>urn:sha1:576b7cd2f6ff1e90b3fc0a000d2fe74f8a50a4bb</id>
<content type='text'>
First, let's explain the problem.
Suppose you have an ipip interface that stands in the netns foo and its link
part in the netns bar (so the netns bar has an nsid into the netns foo).
Now, you remove the netns bar:
 - the bar nsid into the netns foo is removed
 - the netns exit method of ipip is called, thus our ipip iface is removed:
   =&gt; a netlink message is built in the netns foo to advertise this deletion
   =&gt; this netlink message requests an nsid for bar, thus a new nsid is
      allocated for bar and never removed.

This patch adds a check in peernet2id() so that an id cannot be allocated for
a netns which is currently destroyed.

Signed-off-by: Nicolas Dichtel &lt;nicolas.dichtel@6wind.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>Revert "netns: don't clear nsid too early on removal"</title>
<updated>2015-04-03T16:36:31Z</updated>
<author>
<name>Nicolas Dichtel</name>
<email>nicolas.dichtel@6wind.com</email>
</author>
<published>2015-04-03T10:02:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6d458f5b4ece8542a5c2281e40008823fec91814'/>
<id>urn:sha1:6d458f5b4ece8542a5c2281e40008823fec91814</id>
<content type='text'>
This reverts
commit 4217291e592d ("netns: don't clear nsid too early on removal").

This is not the right fix, it introduces races.

Signed-off-by: Nicolas Dichtel &lt;nicolas.dichtel@6wind.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: move fib_rules_unregister() under rtnl lock</title>
<updated>2015-04-03T00:52:34Z</updated>
<author>
<name>WANG Cong</name>
<email>xiyou.wangcong@gmail.com</email>
</author>
<published>2015-03-31T18:01:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=419df12fb5fa558451319276838c1842f2b11f8f'/>
<id>urn:sha1:419df12fb5fa558451319276838c1842f2b11f8f</id>
<content type='text'>
We have to hold rtnl lock for fib_rules_unregister()
otherwise the following race could happen:

fib_rules_unregister():	fib_nl_delrule():
...				...
...				ops = lookup_rules_ops();
list_del_rcu(&amp;ops-&gt;list);
				list_for_each_entry(ops-&gt;rules) {
fib_rules_cleanup_ops(ops);	  ...
  list_del_rcu();		  list_del_rcu();
				}

Note, net-&gt;rules_mod_lock is actually not needed at all,
either upper layer netns code or rtnl lock guarantees
we are safe.

Cc: Alexander Duyck &lt;alexander.h.duyck@redhat.com&gt;
Cc: Thomas Graf &lt;tgraf@suug.ch&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>netns: don't clear nsid too early on removal</title>
<updated>2015-03-29T19:58:21Z</updated>
<author>
<name>Nicolas Dichtel</name>
<email>nicolas.dichtel@6wind.com</email>
</author>
<published>2015-03-26T16:56:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4217291e592da0e4258b652e82e5428639d29acc'/>
<id>urn:sha1:4217291e592da0e4258b652e82e5428639d29acc</id>
<content type='text'>
With the current code, ids are removed too early.
Suppose you have an ipip interface that stands in the netns foo and its link
part in the netns bar (so the netns bar has an nsid into the netns foo).
Now, you remove the netns bar:
 - the bar nsid into the netns foo is removed
 - the netns exit method of ipip is called, thus our ipip iface is removed:
   =&gt; a netlink message is sent in the netns foo to advertise this deletion
   =&gt; this netlink message requests an nsid for bar, thus a new nsid is
      allocated for bar and never removed.

We must remove nsids when we are sure that nobody will refer to netns currently
cleaned.

Fixes: 0c7aecd4bde4 ("netns: add rtnl cmd to add and get peer netns ids")
Signed-off-by: Nicolas Dichtel &lt;nicolas.dichtel@6wind.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: use for_each_netdev_safe() in rtnl_group_changelink()</title>
<updated>2015-03-24T17:02:32Z</updated>
<author>
<name>WANG Cong</name>
<email>xiyou.wangcong@gmail.com</email>
</author>
<published>2015-03-23T23:31:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d079535d5e1bf5e2e7c856bae2483414ea21e137'/>
<id>urn:sha1:d079535d5e1bf5e2e7c856bae2483414ea21e137</id>
<content type='text'>
In case we move the whole dev group to another netns,
we should call for_each_netdev_safe(), otherwise we get
a soft lockup:

 NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [ip:798]
 irq event stamp: 255424
 hardirqs last  enabled at (255423): [&lt;ffffffff81a2aa95&gt;] restore_args+0x0/0x30
 hardirqs last disabled at (255424): [&lt;ffffffff81a2ad5a&gt;] apic_timer_interrupt+0x6a/0x80
 softirqs last  enabled at (255422): [&lt;ffffffff81079ebc&gt;] __do_softirq+0x2c1/0x3a9
 softirqs last disabled at (255417): [&lt;ffffffff8107a190&gt;] irq_exit+0x41/0x95
 CPU: 0 PID: 798 Comm: ip Not tainted 4.0.0-rc4+ #881
 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
 task: ffff8800d1b88000 ti: ffff880119530000 task.ti: ffff880119530000
 RIP: 0010:[&lt;ffffffff810cad11&gt;]  [&lt;ffffffff810cad11&gt;] debug_lockdep_rcu_enabled+0x28/0x30
 RSP: 0018:ffff880119533778  EFLAGS: 00000246
 RAX: ffff8800d1b88000 RBX: 0000000000000002 RCX: 0000000000000038
 RDX: 0000000000000000 RSI: ffff8800d1b888c8 RDI: ffff8800d1b888c8
 RBP: ffff880119533778 R08: 0000000000000000 R09: 0000000000000000
 R10: 0000000000000000 R11: 000000000000b5c2 R12: 0000000000000246
 R13: ffff880119533708 R14: 00000000001d5a40 R15: ffff88011a7d5a40
 FS:  00007fc01315f740(0000) GS:ffff88011a600000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
 CR2: 00007f367a120988 CR3: 000000011849c000 CR4: 00000000000007f0
 Stack:
  ffff880119533798 ffffffff811ac868 ffffffff811ac831 ffffffff811ac828
  ffff8801195337c8 ffffffff811ac8c9 ffff8801195339b0 ffff8801197633e0
  0000000000000000 ffff8801195339b0 ffff8801195337d8 ffffffff811ad2d7
 Call Trace:
  [&lt;ffffffff811ac868&gt;] rcu_read_lock+0x37/0x6e
  [&lt;ffffffff811ac831&gt;] ? rcu_read_unlock+0x5f/0x5f
  [&lt;ffffffff811ac828&gt;] ? rcu_read_unlock+0x56/0x5f
  [&lt;ffffffff811ac8c9&gt;] __fget+0x2a/0x7a
  [&lt;ffffffff811ad2d7&gt;] fget+0x13/0x15
  [&lt;ffffffff811be732&gt;] proc_ns_fget+0xe/0x38
  [&lt;ffffffff817c7714&gt;] get_net_ns_by_fd+0x11/0x59
  [&lt;ffffffff817df359&gt;] rtnl_link_get_net+0x33/0x3e
  [&lt;ffffffff817df3d7&gt;] do_setlink+0x73/0x87b
  [&lt;ffffffff810b28ce&gt;] ? trace_hardirqs_off+0xd/0xf
  [&lt;ffffffff81a2aa95&gt;] ? retint_restore_args+0xe/0xe
  [&lt;ffffffff817e0301&gt;] rtnl_newlink+0x40c/0x699
  [&lt;ffffffff817dffe0&gt;] ? rtnl_newlink+0xeb/0x699
  [&lt;ffffffff81a29246&gt;] ? _raw_spin_unlock+0x28/0x33
  [&lt;ffffffff8143ed1e&gt;] ? security_capable+0x18/0x1a
  [&lt;ffffffff8107da51&gt;] ? ns_capable+0x4d/0x65
  [&lt;ffffffff817de5ce&gt;] rtnetlink_rcv_msg+0x181/0x194
  [&lt;ffffffff817de407&gt;] ? rtnl_lock+0x17/0x19
  [&lt;ffffffff817de407&gt;] ? rtnl_lock+0x17/0x19
  [&lt;ffffffff817de44d&gt;] ? __rtnl_unlock+0x17/0x17
  [&lt;ffffffff818327c6&gt;] netlink_rcv_skb+0x4d/0x93
  [&lt;ffffffff817de42f&gt;] rtnetlink_rcv+0x26/0x2d
  [&lt;ffffffff81830f18&gt;] netlink_unicast+0xcb/0x150
  [&lt;ffffffff8183198e&gt;] netlink_sendmsg+0x501/0x523
  [&lt;ffffffff8115cba9&gt;] ? might_fault+0x59/0xa9
  [&lt;ffffffff817b5398&gt;] ? copy_from_user+0x2a/0x2c
  [&lt;ffffffff817b7b74&gt;] sock_sendmsg+0x34/0x3c
  [&lt;ffffffff817b7f6d&gt;] ___sys_sendmsg+0x1b8/0x255
  [&lt;ffffffff8115c5eb&gt;] ? handle_pte_fault+0xbd5/0xd4a
  [&lt;ffffffff8100a2b0&gt;] ? native_sched_clock+0x35/0x37
  [&lt;ffffffff8109e94b&gt;] ? sched_clock_local+0x12/0x72
  [&lt;ffffffff8109eb9c&gt;] ? sched_clock_cpu+0x9e/0xb7
  [&lt;ffffffff810cadbf&gt;] ? rcu_read_lock_held+0x3b/0x3d
  [&lt;ffffffff811ac1d8&gt;] ? __fcheck_files+0x4c/0x58
  [&lt;ffffffff811ac946&gt;] ? __fget_light+0x2d/0x52
  [&lt;ffffffff817b8adc&gt;] __sys_sendmsg+0x42/0x60
  [&lt;ffffffff817b8b0c&gt;] SyS_sendmsg+0x12/0x1c
  [&lt;ffffffff81a29e32&gt;] system_call_fastpath+0x12/0x17

Fixes: e7ed828f10bd8 ("netlink: support setting devgroup parameters")
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>sock: fix possible NULL sk dereference in __skb_tstamp_tx</title>
<updated>2015-03-12T04:09:55Z</updated>
<author>
<name>Willem de Bruijn</name>
<email>willemb@google.com</email>
</author>
<published>2015-03-11T19:43:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3a8dd9711e0792f64394edafadd66c2d1f1904df'/>
<id>urn:sha1:3a8dd9711e0792f64394edafadd66c2d1f1904df</id>
<content type='text'>
Test that sk != NULL before reading sk-&gt;sk_tsflags.

Fixes: 49ca0d8bfaf3 ("net-timestamp: no-payload option")
Reported-by: One Thousand Gnomes &lt;gnomes@lxorguk.ukuu.org.uk&gt;
Signed-off-by: Willem de Bruijn &lt;willemb@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>xps: must clear sender_cpu before forwarding</title>
<updated>2015-03-12T03:51:18Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2015-03-12T01:42:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c29390c6dfeee0944ac6b5610ebbe403944378fc'/>
<id>urn:sha1:c29390c6dfeee0944ac6b5610ebbe403944378fc</id>
<content type='text'>
John reported that my previous commit added a regression
on his router.

This is because sender_cpu &amp; napi_id share a common location,
so get_xps_queue() can see garbage and perform an out of bound access.

We need to make sure sender_cpu is cleared before doing the transmit,
otherwise any NIC busy poll enabled (skb_mark_napi_id()) can trigger
this bug.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reported-by: John &lt;jw@nuclearfallout.net&gt;
Bisected-by: John &lt;jw@nuclearfallout.net&gt;
Fixes: 2bd82484bb4c ("xps: fix xps for stacked devices")
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: sysctl_net_core: check SNDBUF and RCVBUF for min length</title>
<updated>2015-03-12T01:25:13Z</updated>
<author>
<name>Alexey Kodanev</name>
<email>alexey.kodanev@oracle.com</email>
</author>
<published>2015-03-11T11:29:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b1cb59cf2efe7971d3d72a7b963d09a512d994c9'/>
<id>urn:sha1:b1cb59cf2efe7971d3d72a7b963d09a512d994c9</id>
<content type='text'>
sysctl has sysctl.net.core.rmem_*/wmem_* parameters which can be
set to incorrect values. Given that 'struct sk_buff' allocates from
rcvbuf, incorrectly set buffer length could result to memory
allocation failures. For example, set them as follows:

    # sysctl net.core.rmem_default=64
      net.core.wmem_default = 64
    # sysctl net.core.wmem_default=64
      net.core.wmem_default = 64
    # ping localhost -s 1024 -i 0 &gt; /dev/null

This could result to the following failure:

skbuff: skb_over_panic: text:ffffffff81628db4 len:-32 put:-32
head:ffff88003a1cc200 data:ffff88003a1cc200 tail:0xffffffe0 end:0xc0 dev:&lt;NULL&gt;
kernel BUG at net/core/skbuff.c:102!
invalid opcode: 0000 [#1] SMP
...
task: ffff88003b7f5550 ti: ffff88003ae88000 task.ti: ffff88003ae88000
RIP: 0010:[&lt;ffffffff8155fbd1&gt;]  [&lt;ffffffff8155fbd1&gt;] skb_put+0xa1/0xb0
RSP: 0018:ffff88003ae8bc68  EFLAGS: 00010296
RAX: 000000000000008d RBX: 00000000ffffffe0 RCX: 0000000000000000
RDX: ffff88003fdcf598 RSI: ffff88003fdcd9c8 RDI: ffff88003fdcd9c8
RBP: ffff88003ae8bc88 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000001 R11: 00000000000002b2 R12: 0000000000000000
R13: 0000000000000000 R14: ffff88003d3f7300 R15: ffff88000012a900
FS:  00007fa0e2b4a840(0000) GS:ffff88003fc00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000d0f7e0 CR3: 000000003b8fb000 CR4: 00000000000006f0
Stack:
 ffff88003a1cc200 00000000ffffffe0 00000000000000c0 ffffffff818cab1d
 ffff88003ae8bd68 ffffffff81628db4 ffff88003ae8bd48 ffff88003b7f5550
 ffff880031a09408 ffff88003b7f5550 ffff88000012aa48 ffff88000012ab00
Call Trace:
 [&lt;ffffffff81628db4&gt;] unix_stream_sendmsg+0x2c4/0x470
 [&lt;ffffffff81556f56&gt;] sock_write_iter+0x146/0x160
 [&lt;ffffffff811d9612&gt;] new_sync_write+0x92/0xd0
 [&lt;ffffffff811d9cd6&gt;] vfs_write+0xd6/0x180
 [&lt;ffffffff811da499&gt;] SyS_write+0x59/0xd0
 [&lt;ffffffff81651532&gt;] system_call_fastpath+0x12/0x17
Code: 00 00 48 89 44 24 10 8b 87 c8 00 00 00 48 89 44 24 08 48 8b 87 d8 00
      00 00 48 c7 c7 30 db 91 81 48 89 04 24 31 c0 e8 4f a8 0e 00 &lt;0f&gt; 0b
      eb fe 66 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 48 83
RIP  [&lt;ffffffff8155fbd1&gt;] skb_put+0xa1/0xb0
RSP &lt;ffff88003ae8bc68&gt;
Kernel panic - not syncing: Fatal exception

Moreover, the possible minimum is 1, so we can get another kernel panic:
...
BUG: unable to handle kernel paging request at ffff88013caee5c0
IP: [&lt;ffffffff815604cf&gt;] __alloc_skb+0x12f/0x1f0
...

Signed-off-by: Alexey Kodanev &lt;alexey.kodanev@oracle.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: Handle unregister properly when netdev namespace change fails.</title>
<updated>2015-03-11T01:59:46Z</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2015-03-11T01:58:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4363890079674db7b00cf1bb0e6fa430e846e86b'/>
<id>urn:sha1:4363890079674db7b00cf1bb0e6fa430e846e86b</id>
<content type='text'>
If rtnl_newlink() fails on it's call to dev_change_net_namespace(), we
have to make use of the -&gt;dellink() method, if present, just like we
do when rtnl_configure_link() fails.

Fixes: 317f4810e45e ("rtnl: allow to create device with IFLA_LINK_NETNSID set")
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
