<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/net/ipv6/ip6_fib.c, branch linux-6.2.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.2.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.2.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2022-11-16T12:42:00Z</updated>
<entry>
<title>ipv6: fib6_new_sernum() optimization</title>
<updated>2022-11-16T12:42:00Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2022-11-15T09:10:57Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=30189806fbb945c4cb753878aab0aa5af07bc921'/>
<id>urn:sha1:30189806fbb945c4cb753878aab0aa5af07bc921</id>
<content type='text'>
Adopt atomic_try_cmpxchg() which is slightly more efficient.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: David Ahern &lt;dsahern@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ipv6: annotate accesses to fn-&gt;fn_sernum</title>
<updated>2022-01-21T04:18:37Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2022-01-20T17:41:12Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=aafc2e3285c2d7a79b7ee15221c19fbeca7b1509'/>
<id>urn:sha1:aafc2e3285c2d7a79b7ee15221c19fbeca7b1509</id>
<content type='text'>
struct fib6_node's fn_sernum field can be
read while other threads change it.

Add READ_ONCE()/WRITE_ONCE() annotations.

Do not change existing smp barriers in fib6_get_cookie_safe()
and __fib6_update_sernum_upto_root()

syzbot reported:

BUG: KCSAN: data-race in fib6_clean_node / inet6_csk_route_socket

write to 0xffff88813df62e2c of 4 bytes by task 1920 on cpu 1:
 fib6_clean_node+0xc2/0x260 net/ipv6/ip6_fib.c:2178
 fib6_walk_continue+0x38e/0x430 net/ipv6/ip6_fib.c:2112
 fib6_walk net/ipv6/ip6_fib.c:2160 [inline]
 fib6_clean_tree net/ipv6/ip6_fib.c:2240 [inline]
 __fib6_clean_all+0x1a9/0x2e0 net/ipv6/ip6_fib.c:2256
 fib6_flush_trees+0x6c/0x80 net/ipv6/ip6_fib.c:2281
 rt_genid_bump_ipv6 include/net/net_namespace.h:488 [inline]
 addrconf_dad_completed+0x57f/0x870 net/ipv6/addrconf.c:4230
 addrconf_dad_work+0x908/0x1170
 process_one_work+0x3f6/0x960 kernel/workqueue.c:2307
 worker_thread+0x616/0xa70 kernel/workqueue.c:2454
 kthread+0x1bf/0x1e0 kernel/kthread.c:359
 ret_from_fork+0x1f/0x30

read to 0xffff88813df62e2c of 4 bytes by task 15701 on cpu 0:
 fib6_get_cookie_safe include/net/ip6_fib.h:285 [inline]
 rt6_get_cookie include/net/ip6_fib.h:306 [inline]
 ip6_dst_store include/net/ip6_route.h:234 [inline]
 inet6_csk_route_socket+0x352/0x3c0 net/ipv6/inet6_connection_sock.c:109
 inet6_csk_xmit+0x91/0x1e0 net/ipv6/inet6_connection_sock.c:121
 __tcp_transmit_skb+0x1323/0x1840 net/ipv4/tcp_output.c:1402
 tcp_transmit_skb net/ipv4/tcp_output.c:1420 [inline]
 tcp_write_xmit+0x1450/0x4460 net/ipv4/tcp_output.c:2680
 __tcp_push_pending_frames+0x68/0x1c0 net/ipv4/tcp_output.c:2864
 tcp_push+0x2d9/0x2f0 net/ipv4/tcp.c:725
 mptcp_push_release net/mptcp/protocol.c:1491 [inline]
 __mptcp_push_pending+0x46c/0x490 net/mptcp/protocol.c:1578
 mptcp_sendmsg+0x9ec/0xa50 net/mptcp/protocol.c:1764
 inet6_sendmsg+0x5f/0x80 net/ipv6/af_inet6.c:643
 sock_sendmsg_nosec net/socket.c:705 [inline]
 sock_sendmsg net/socket.c:725 [inline]
 kernel_sendmsg+0x97/0xd0 net/socket.c:745
 sock_no_sendpage+0x84/0xb0 net/core/sock.c:3086
 inet_sendpage+0x9d/0xc0 net/ipv4/af_inet.c:834
 kernel_sendpage+0x187/0x200 net/socket.c:3492
 sock_sendpage+0x5a/0x70 net/socket.c:1007
 pipe_to_sendpage+0x128/0x160 fs/splice.c:364
 splice_from_pipe_feed fs/splice.c:418 [inline]
 __splice_from_pipe+0x207/0x500 fs/splice.c:562
 splice_from_pipe fs/splice.c:597 [inline]
 generic_splice_sendpage+0x94/0xd0 fs/splice.c:746
 do_splice_from fs/splice.c:767 [inline]
 direct_splice_actor+0x80/0xa0 fs/splice.c:936
 splice_direct_to_actor+0x345/0x650 fs/splice.c:891
 do_splice_direct+0x106/0x190 fs/splice.c:979
 do_sendfile+0x675/0xc40 fs/read_write.c:1245
 __do_sys_sendfile64 fs/read_write.c:1310 [inline]
 __se_sys_sendfile64 fs/read_write.c:1296 [inline]
 __x64_sys_sendfile64+0x102/0x140 fs/read_write.c:1296
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

value changed: 0x0000026f -&gt; 0x00000271

Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 15701 Comm: syz-executor.2 Not tainted 5.16.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011

The Fixes tag I chose is probably arbitrary, I do not think
we need to backport this patch to older kernels.

Fixes: c5cff8561d2d ("ipv6: add rcu grace period before freeing fib6_node")
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reported-by: syzbot &lt;syzkaller@googlegroups.com&gt;
Link: https://lore.kernel.org/r/20220120174112.1126644-1-eric.dumazet@gmail.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: Don't include filter.h from net/sock.h</title>
<updated>2021-12-29T16:48:14Z</updated>
<author>
<name>Jakub Kicinski</name>
<email>kuba@kernel.org</email>
</author>
<published>2021-12-29T00:49:13Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=b6459415b384cb829f0b2a4268f211c789f6cf0b'/>
<id>urn:sha1:b6459415b384cb829f0b2a4268f211c789f6cf0b</id>
<content type='text'>
sock.h is pretty heavily used (5k objects rebuilt on x86 after
it's touched). We can drop the include of filter.h from it and
add a forward declaration of struct sk_filter instead.
This decreases the number of rebuilt objects when bpf.h
is touched from ~5k to ~1k.

There's a lot of missing includes this was masking. Primarily
in networking tho, this time.

Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
Acked-by: Florian Fainelli &lt;f.fainelli@gmail.com&gt;
Acked-by: Nikolay Aleksandrov &lt;nikolay@nvidia.com&gt;
Acked-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Link: https://lore.kernel.org/bpf/20211229004913.513372-1-kuba@kernel.org
</content>
</entry>
<entry>
<title>ipv6: delay fib6_sernum increase in fib6_add</title>
<updated>2021-09-13T12:00:53Z</updated>
<author>
<name>zhang kai</name>
<email>zhangkaiheb@126.com</email>
</author>
<published>2021-09-09T08:39:18Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=e87b5052271e39d62337ade531992b7e5d8c2cfa'/>
<id>urn:sha1:e87b5052271e39d62337ade531992b7e5d8c2cfa</id>
<content type='text'>
only increase fib6_sernum in net namespace after add fib6_info
successfully.

Signed-off-by: zhang kai &lt;zhangkaiheb@126.com&gt;
Reviewed-by: David Ahern &lt;dsahern@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net</title>
<updated>2021-08-27T00:57:57Z</updated>
<author>
<name>Jakub Kicinski</name>
<email>kuba@kernel.org</email>
</author>
<published>2021-08-26T20:45:47Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=97c78d0af55fff206947a5f2b85b690b5acf28ce'/>
<id>urn:sha1:97c78d0af55fff206947a5f2b85b690b5acf28ce</id>
<content type='text'>
drivers/net/wwan/mhi_wwan_mbim.c - drop the extra arg.

Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>ipv6: correct comments about fib6_node sernum</title>
<updated>2021-08-24T08:59:01Z</updated>
<author>
<name>zhang kai</name>
<email>zhangkaiheb@126.com</email>
</author>
<published>2021-08-23T03:49:00Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=446e7f218b7662c912c610aae99069543aa88a40'/>
<id>urn:sha1:446e7f218b7662c912c610aae99069543aa88a40</id>
<content type='text'>
correct comments in set and get fn_sernum

Signed-off-by: zhang kai &lt;zhangkaiheb@126.com&gt;
Reviewed-by: David Ahern &lt;dsahern@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>memcg: enable accounting for IP address and routing-related objects</title>
<updated>2021-07-20T13:00:38Z</updated>
<author>
<name>Vasily Averin</name>
<email>vvs@virtuozzo.com</email>
</author>
<published>2021-07-19T10:44:31Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=6126891c6d4f6f4ef50323d2020635ee255a796e'/>
<id>urn:sha1:6126891c6d4f6f4ef50323d2020635ee255a796e</id>
<content type='text'>
An netadmin inside container can use 'ip a a' and 'ip r a'
to assign a large number of ipv4/ipv6 addresses and routing entries
and force kernel to allocate megabytes of unaccounted memory
for long-lived per-netdevice related kernel objects:
'struct in_ifaddr', 'struct inet6_ifaddr', 'struct fib6_node',
'struct rt6_info', 'struct fib_rules' and ip_fib caches.

These objects can be manually removed, though usually they lives
in memory till destroy of its net namespace.

It makes sense to account for them to restrict the host's memory
consumption from inside the memcg-limited container.

One of such objects is the 'struct fib6_node' mostly allocated in
net/ipv6/route.c::__ip6_ins_rt() inside the lock_bh()/unlock_bh() section:

 write_lock_bh(&amp;table-&gt;tb6_lock);
 err = fib6_add(&amp;table-&gt;tb6_root, rt, info, mxc);
 write_unlock_bh(&amp;table-&gt;tb6_lock);

In this case it is not enough to simply add SLAB_ACCOUNT to corresponding
kmem cache. The proper memory cgroup still cannot be found due to the
incorrect 'in_interrupt()' check used in memcg_kmem_bypass().

Obsoleted in_interrupt() does not describe real execution context properly.
&gt;From include/linux/preempt.h:

 The following macros are deprecated and should not be used in new code:
 in_interrupt()	- We're in NMI,IRQ,SoftIRQ context or have BH disabled

To verify the current execution context new macro should be used instead:
 in_task()	- We're in task context

Signed-off-by: Vasily Averin &lt;vvs@virtuozzo.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ipv6: Add a sysctl to control multipath hash fields</title>
<updated>2021-05-18T20:27:32Z</updated>
<author>
<name>Ido Schimmel</name>
<email>idosch@OSS.NVIDIA.COM</email>
</author>
<published>2021-05-17T18:15:22Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=ed13923f980ef84dde0b9010b9e09052dc31a909'/>
<id>urn:sha1:ed13923f980ef84dde0b9010b9e09052dc31a909</id>
<content type='text'>
A subsequent patch will add a new multipath hash policy where the packet
fields used for multipath hash calculation are determined by user space.
This patch adds a sysctl that allows user space to set these fields.

The packet fields are represented using a bitmask and are common between
IPv4 and IPv6 to allow user space to use the same numbering across both
protocols. For example, to hash based on standard 5-tuple:

 # sysctl -w net.ipv6.fib_multipath_hash_fields=0x0037
 net.ipv6.fib_multipath_hash_fields = 0x0037

To avoid introducing holes in 'struct netns_sysctl_ipv6', move the
'bindv6only' field after the multipath hash fields.

The kernel rejects unknown fields, for example:

 # sysctl -w net.ipv6.fib_multipath_hash_fields=0x1000
 sysctl: setting key "net.ipv6.fib_multipath_hash_fields": Invalid argument

Signed-off-by: Ido Schimmel &lt;idosch@nvidia.com&gt;
Reviewed-by: David Ahern &lt;dsahern@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ipv6: Use a more suitable label name</title>
<updated>2021-05-18T20:27:32Z</updated>
<author>
<name>Ido Schimmel</name>
<email>idosch@OSS.NVIDIA.COM</email>
</author>
<published>2021-05-17T18:15:20Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=67db5ca73b1f98584ae9b6ed35c1c670677c9001'/>
<id>urn:sha1:67db5ca73b1f98584ae9b6ed35c1c670677c9001</id>
<content type='text'>
The 'out_timer' label was added in commit 63152fc0de4d ("[NETNS][IPV6]
ip6_fib - gc timer per namespace") when the timer was allocated on the
heap.

Commit 417f28bb3407 ("netns: dont alloc ipv6 fib timer list") removed
the allocation, but kept the label name.

Rename it to a more suitable name.

Signed-off-by: Ido Schimmel &lt;idosch@nvidia.com&gt;
Reviewed-by: David Ahern &lt;dsahern@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ipv6: fix suspecious RCU usage warning</title>
<updated>2021-03-10T20:35:23Z</updated>
<author>
<name>Wei Wang</name>
<email>weiwan@google.com</email>
</author>
<published>2021-03-10T02:20:35Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=28259bac7f1dde06d8ba324e222bbec9d4e92f2b'/>
<id>urn:sha1:28259bac7f1dde06d8ba324e222bbec9d4e92f2b</id>
<content type='text'>
Syzbot reported the suspecious RCU usage in nexthop_fib6_nh() when
called from ipv6_route_seq_show(). The reason is ipv6_route_seq_start()
calls rcu_read_lock_bh(), while nexthop_fib6_nh() calls
rcu_dereference_rtnl().
The fix proposed is to add a variant of nexthop_fib6_nh() to use
rcu_dereference_bh_rtnl() for ipv6_route_seq_show().

The reported trace is as follows:
./include/net/nexthop.h:416 suspicious rcu_dereference_check() usage!

other info that might help us debug this:

rcu_scheduler_active = 2, debug_locks = 1
2 locks held by syz-executor.0/17895:
     at: seq_read+0x71/0x12a0 fs/seq_file.c:169
     at: seq_file_net include/linux/seq_file_net.h:19 [inline]
     at: ipv6_route_seq_start+0xaf/0x300 net/ipv6/ip6_fib.c:2616

stack backtrace:
CPU: 1 PID: 17895 Comm: syz-executor.0 Not tainted 4.15.0-syzkaller #0
Call Trace:
 [&lt;ffffffff849edf9e&gt;] __dump_stack lib/dump_stack.c:17 [inline]
 [&lt;ffffffff849edf9e&gt;] dump_stack+0xd8/0x147 lib/dump_stack.c:53
 [&lt;ffffffff8480b7fa&gt;] lockdep_rcu_suspicious+0x153/0x15d kernel/locking/lockdep.c:5745
 [&lt;ffffffff8459ada6&gt;] nexthop_fib6_nh include/net/nexthop.h:416 [inline]
 [&lt;ffffffff8459ada6&gt;] ipv6_route_native_seq_show net/ipv6/ip6_fib.c:2488 [inline]
 [&lt;ffffffff8459ada6&gt;] ipv6_route_seq_show+0x436/0x7a0 net/ipv6/ip6_fib.c:2673
 [&lt;ffffffff81c556df&gt;] seq_read+0xccf/0x12a0 fs/seq_file.c:276
 [&lt;ffffffff81dbc62c&gt;] proc_reg_read+0x10c/0x1d0 fs/proc/inode.c:231
 [&lt;ffffffff81bc28ae&gt;] do_loop_readv_writev fs/read_write.c:714 [inline]
 [&lt;ffffffff81bc28ae&gt;] do_loop_readv_writev fs/read_write.c:701 [inline]
 [&lt;ffffffff81bc28ae&gt;] do_iter_read+0x49e/0x660 fs/read_write.c:935
 [&lt;ffffffff81bc81ab&gt;] vfs_readv+0xfb/0x170 fs/read_write.c:997
 [&lt;ffffffff81c88847&gt;] kernel_readv fs/splice.c:361 [inline]
 [&lt;ffffffff81c88847&gt;] default_file_splice_read+0x487/0x9c0 fs/splice.c:416
 [&lt;ffffffff81c86189&gt;] do_splice_to+0x129/0x190 fs/splice.c:879
 [&lt;ffffffff81c86f66&gt;] splice_direct_to_actor+0x256/0x890 fs/splice.c:951
 [&lt;ffffffff81c8777d&gt;] do_splice_direct+0x1dd/0x2b0 fs/splice.c:1060
 [&lt;ffffffff81bc4747&gt;] do_sendfile+0x597/0xce0 fs/read_write.c:1459
 [&lt;ffffffff81bca205&gt;] SYSC_sendfile64 fs/read_write.c:1520 [inline]
 [&lt;ffffffff81bca205&gt;] SyS_sendfile64+0x155/0x170 fs/read_write.c:1506
 [&lt;ffffffff81015fcf&gt;] do_syscall_64+0x1ff/0x310 arch/x86/entry/common.c:305
 [&lt;ffffffff84a00076&gt;] entry_SYSCALL_64_after_hwframe+0x42/0xb7

Fixes: f88d8ea67fbdb ("ipv6: Plumb support for nexthop object in a fib6_info")
Reported-by: syzbot &lt;syzkaller@googlegroups.com&gt;
Signed-off-by: Wei Wang &lt;weiwan@google.com&gt;
Cc: David Ahern &lt;dsahern@kernel.org&gt;
Cc: Ido Schimmel &lt;idosch@idosch.org&gt;
Cc: Petr Machata &lt;petrm@nvidia.com&gt;
Cc: Eric Dumazet &lt;edumazet@google.com&gt;
Reviewed-by: Ido Schimmel &lt;idosch@nvidia.com&gt;
Reviewed-by: David Ahern &lt;dsahern@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
