1. 23 2月, 2023 1 次提交
    • L
      ipv6: Add lwtunnel encap size of all siblings in nexthop calculation · 4cc59f38
      Lu Wei 提交于
      In function rt6_nlmsg_size(), the length of nexthop is calculated
      by multipling the nexthop length of fib6_info and the number of
      siblings. However if the fib6_info has no lwtunnel but the siblings
      have lwtunnels, the nexthop length is less than it should be, and
      it will trigger a warning in inet6_rt_notify() as follows:
      
      WARNING: CPU: 0 PID: 6082 at net/ipv6/route.c:6180 inet6_rt_notify+0x120/0x130
      ......
      Call Trace:
       <TASK>
       fib6_add_rt2node+0x685/0xa30
       fib6_add+0x96/0x1b0
       ip6_route_add+0x50/0xd0
       inet6_rtm_newroute+0x97/0xa0
       rtnetlink_rcv_msg+0x156/0x3d0
       netlink_rcv_skb+0x5a/0x110
       netlink_unicast+0x246/0x350
       netlink_sendmsg+0x250/0x4c0
       sock_sendmsg+0x66/0x70
       ___sys_sendmsg+0x7c/0xd0
       __sys_sendmsg+0x5d/0xb0
       do_syscall_64+0x3f/0x90
       entry_SYSCALL_64_after_hwframe+0x72/0xdc
      
      This bug can be reproduced by script:
      
      ip -6 addr add 2002::2/64 dev ens2
      ip -6 route add 100::/64 via 2002::1 dev ens2 metric 100
      
      for i in 10 20 30 40 50 60 70;
      do
      	ip link add link ens2 name ipv_$i type ipvlan
      	ip -6 addr add 2002::$i/64 dev ipv_$i
      	ifconfig ipv_$i up
      done
      
      for i in 10 20 30 40 50 60;
      do
      	ip -6 route append 100::/64 encap ip6 dst 2002::$i via 2002::1
      dev ipv_$i metric 100
      done
      
      ip -6 route append 100::/64 via 2002::1 dev ipv_70 metric 100
      
      This patch fixes it by adding nexthop_len of every siblings using
      rt6_nh_nlmsg_size().
      
      Fixes: beb1afac ("net: ipv6: Add support to dump multipath routes via RTA_MULTIPATH attribute")
      Signed-off-by: NLu Wei <luwei32@huawei.com>
      Reviewed-by: NDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20230222083629.335683-2-luwei32@huawei.comSigned-off-by: NPaolo Abeni <pabeni@redhat.com>
      4cc59f38
  2. 25 1月, 2023 1 次提交
  3. 18 1月, 2023 1 次提交
  4. 14 1月, 2023 1 次提交
    • J
      ipv6: remove max_size check inline with ipv4 · af6d1034
      Jon Maxwell 提交于
      In ip6_dst_gc() replace:
      
        if (entries > gc_thresh)
      
      With:
      
        if (entries > ops->gc_thresh)
      
      Sending Ipv6 packets in a loop via a raw socket triggers an issue where a
      route is cloned by ip6_rt_cache_alloc() for each packet sent. This quickly
      consumes the Ipv6 max_size threshold which defaults to 4096 resulting in
      these warnings:
      
      [1]   99.187805] dst_alloc: 7728 callbacks suppressed
      [2] Route cache is full: consider increasing sysctl net.ipv6.route.max_size.
      .
      .
      [300] Route cache is full: consider increasing sysctl net.ipv6.route.max_size.
      
      When this happens the packet is dropped and sendto() gets a network is
      unreachable error:
      
      remaining pkt 200557 errno 101
      remaining pkt 196462 errno 101
      .
      .
      remaining pkt 126821 errno 101
      
      Implement David Aherns suggestion to remove max_size check seeing that Ipv6
      has a GC to manage memory usage. Ipv4 already does not check max_size.
      
      Here are some memory comparisons for Ipv4 vs Ipv6 with the patch:
      
      Test by running 5 instances of a program that sends UDP packets to a raw
      socket 5000000 times. Compare Ipv4 and Ipv6 performance with a similar
      program.
      
      Ipv4:
      
      Before test:
      
      MemFree:        29427108 kB
      Slab:             237612 kB
      
      ip6_dst_cache       1912   2528    256   32    2 : tunables    0    0    0
      xfrm_dst_cache         0      0    320   25    2 : tunables    0    0    0
      ip_dst_cache        2881   3990    192   42    2 : tunables    0    0    0
      
      During test:
      
      MemFree:        29417608 kB
      Slab:             247712 kB
      
      ip6_dst_cache       1912   2528    256   32    2 : tunables    0    0    0
      xfrm_dst_cache         0      0    320   25    2 : tunables    0    0    0
      ip_dst_cache       44394  44394    192   42    2 : tunables    0    0    0
      
      After test:
      
      MemFree:        29422308 kB
      Slab:             238104 kB
      
      ip6_dst_cache       1912   2528    256   32    2 : tunables    0    0    0
      xfrm_dst_cache         0      0    320   25    2 : tunables    0    0    0
      ip_dst_cache        3048   4116    192   42    2 : tunables    0    0    0
      
      Ipv6 with patch:
      
      Errno 101 errors are not observed anymore with the patch.
      
      Before test:
      
      MemFree:        29422308 kB
      Slab:             238104 kB
      
      ip6_dst_cache       1912   2528    256   32    2 : tunables    0    0    0
      xfrm_dst_cache         0      0    320   25    2 : tunables    0    0    0
      ip_dst_cache        3048   4116    192   42    2 : tunables    0    0    0
      
      During Test:
      
      MemFree:        29431516 kB
      Slab:             240940 kB
      
      ip6_dst_cache      11980  12064    256   32    2 : tunables    0    0    0
      xfrm_dst_cache         0      0    320   25    2 : tunables    0    0    0
      ip_dst_cache        3048   4116    192   42    2 : tunables    0    0    0
      
      After Test:
      
      MemFree:        29441816 kB
      Slab:             238132 kB
      
      ip6_dst_cache       1902   2432    256   32    2 : tunables    0    0    0
      xfrm_dst_cache         0      0    320   25    2 : tunables    0    0    0
      ip_dst_cache        3048   4116    192   42    2 : tunables    0    0    0
      Tested-by: NAndrea Mayer <andrea.mayer@uniroma2.it>
      Signed-off-by: NJon Maxwell <jmaxwell37@gmail.com>
      Reviewed-by: NDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20230112012532.311021-1-jmaxwell37@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      af6d1034
  5. 18 11月, 2022 1 次提交
  6. 03 11月, 2022 1 次提交
  7. 13 7月, 2022 1 次提交
  8. 30 6月, 2022 1 次提交
  9. 28 6月, 2022 1 次提交
  10. 10 6月, 2022 1 次提交
  11. 16 4月, 2022 1 次提交
    • E
      ipv6: make ip6_rt_gc_expire an atomic_t · 9cb7c013
      Eric Dumazet 提交于
      Reads and Writes to ip6_rt_gc_expire always have been racy,
      as syzbot reported lately [1]
      
      There is a possible risk of under-flow, leading
      to unexpected high value passed to fib6_run_gc(),
      although I have not observed this in the field.
      
      Hosts hitting ip6_dst_gc() very hard are under pretty bad
      state anyway.
      
      [1]
      BUG: KCSAN: data-race in ip6_dst_gc / ip6_dst_gc
      
      read-write to 0xffff888102110744 of 4 bytes by task 13165 on cpu 1:
       ip6_dst_gc+0x1f3/0x220 net/ipv6/route.c:3311
       dst_alloc+0x9b/0x160 net/core/dst.c:86
       ip6_dst_alloc net/ipv6/route.c:344 [inline]
       icmp6_dst_alloc+0xb2/0x360 net/ipv6/route.c:3261
       mld_sendpack+0x2b9/0x580 net/ipv6/mcast.c:1807
       mld_send_cr net/ipv6/mcast.c:2119 [inline]
       mld_ifc_work+0x576/0x800 net/ipv6/mcast.c:2651
       process_one_work+0x3d3/0x720 kernel/workqueue.c:2289
       worker_thread+0x618/0xa70 kernel/workqueue.c:2436
       kthread+0x1a9/0x1e0 kernel/kthread.c:376
       ret_from_fork+0x1f/0x30
      
      read-write to 0xffff888102110744 of 4 bytes by task 11607 on cpu 0:
       ip6_dst_gc+0x1f3/0x220 net/ipv6/route.c:3311
       dst_alloc+0x9b/0x160 net/core/dst.c:86
       ip6_dst_alloc net/ipv6/route.c:344 [inline]
       icmp6_dst_alloc+0xb2/0x360 net/ipv6/route.c:3261
       mld_sendpack+0x2b9/0x580 net/ipv6/mcast.c:1807
       mld_send_cr net/ipv6/mcast.c:2119 [inline]
       mld_ifc_work+0x576/0x800 net/ipv6/mcast.c:2651
       process_one_work+0x3d3/0x720 kernel/workqueue.c:2289
       worker_thread+0x618/0xa70 kernel/workqueue.c:2436
       kthread+0x1a9/0x1e0 kernel/kthread.c:376
       ret_from_fork+0x1f/0x30
      
      value changed: 0x00000bb3 -> 0x00000ba9
      
      Reported by Kernel Concurrency Sanitizer on:
      CPU: 0 PID: 11607 Comm: kworker/0:21 Not tainted 5.18.0-rc1-syzkaller-00037-g42e7a03d-dirty #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Workqueue: mld mld_ifc_work
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Reported-by: Nsyzbot <syzkaller@googlegroups.com>
      Reviewed-by: NDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20220413181333.649424-1-eric.dumazet@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      9cb7c013
  12. 13 4月, 2022 1 次提交
  13. 05 4月, 2022 1 次提交
  14. 16 3月, 2022 1 次提交
    • D
      net: Add l3mdev index to flow struct and avoid oif reset for port devices · 40867d74
      David Ahern 提交于
      The fundamental premise of VRF and l3mdev core code is binding a socket
      to a device (l3mdev or netdev with an L3 domain) to indicate L3 scope.
      Legacy code resets flowi_oif to the l3mdev losing any original port
      device binding. Ben (among others) has demonstrated use cases where the
      original port device binding is important and needs to be retained.
      This patch handles that by adding a new entry to the common flow struct
      that can indicate the l3mdev index for later rule and table matching
      avoiding the need to reset flowi_oif.
      
      In addition to allowing more use cases that require port device binds,
      this patch brings a few datapath simplications:
      
      1. l3mdev_fib_rule_match is only called when walking fib rules and
         always after l3mdev_update_flow. That allows an optimization to bail
         early for non-VRF type uses cases when flowi_l3mdev is not set. Also,
         only that index needs to be checked for the FIB table id.
      
      2. l3mdev_update_flow can be called with flowi_oif set to a l3mdev
         (e.g., VRF) device. By resetting flowi_oif only for this case the
         FLOWI_FLAG_SKIP_NH_OIF flag is not longer needed and can be removed,
         removing several checks in the datapath. The flowi_iif path can be
         simplified to only be called if the it is not loopback (loopback can
         not be assigned to an L3 domain) and the l3mdev index is not already
         set.
      
      3. Avoid another device lookup in the output path when the fib lookup
         returns a reject failure.
      
      Note: 2 functional tests for local traffic with reject fib rules are
      updated to reflect the new direct failure at FIB lookup time for ping
      rather than the failure on packet path. The current code fails like this:
      
          HINT: Fails since address on vrf device is out of device scope
          COMMAND: ip netns exec ns-A ping -c1 -w1 -I eth1 172.16.3.1
          ping: Warning: source address might be selected on device other than: eth1
          PING 172.16.3.1 (172.16.3.1) from 172.16.3.1 eth1: 56(84) bytes of data.
      
          --- 172.16.3.1 ping statistics ---
          1 packets transmitted, 0 received, 100% packet loss, time 0ms
      
      where the test now directly fails:
      
          HINT: Fails since address on vrf device is out of device scope
          COMMAND: ip netns exec ns-A ping -c1 -w1 -I eth1 172.16.3.1
          ping: connect: No route to host
      Signed-off-by: NDavid Ahern <dsahern@kernel.org>
      Tested-by: NBen Greear <greearb@candelatech.com>
      Link: https://lore.kernel.org/r/20220314204551.16369-1-dsahern@kernel.orgSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      40867d74
  15. 18 2月, 2022 1 次提交
    • E
      ipv6: fix data-race in fib6_info_hw_flags_set / fib6_purge_rt · d95d6320
      Eric Dumazet 提交于
      Because fib6_info_hw_flags_set() is called without any synchronization,
      all accesses to gi6->offload, fi->trap and fi->offload_failed
      need some basic protection like READ_ONCE()/WRITE_ONCE().
      
      BUG: KCSAN: data-race in fib6_info_hw_flags_set / fib6_purge_rt
      
      read to 0xffff8881087d5886 of 1 bytes by task 13953 on cpu 0:
       fib6_drop_pcpu_from net/ipv6/ip6_fib.c:1007 [inline]
       fib6_purge_rt+0x4f/0x580 net/ipv6/ip6_fib.c:1033
       fib6_del_route net/ipv6/ip6_fib.c:1983 [inline]
       fib6_del+0x696/0x890 net/ipv6/ip6_fib.c:2028
       __ip6_del_rt net/ipv6/route.c:3876 [inline]
       ip6_del_rt+0x83/0x140 net/ipv6/route.c:3891
       __ipv6_dev_ac_dec+0x2b5/0x370 net/ipv6/anycast.c:374
       ipv6_dev_ac_dec net/ipv6/anycast.c:387 [inline]
       __ipv6_sock_ac_close+0x141/0x200 net/ipv6/anycast.c:207
       ipv6_sock_ac_close+0x79/0x90 net/ipv6/anycast.c:220
       inet6_release+0x32/0x50 net/ipv6/af_inet6.c:476
       __sock_release net/socket.c:650 [inline]
       sock_close+0x6c/0x150 net/socket.c:1318
       __fput+0x295/0x520 fs/file_table.c:280
       ____fput+0x11/0x20 fs/file_table.c:313
       task_work_run+0x8e/0x110 kernel/task_work.c:164
       tracehook_notify_resume include/linux/tracehook.h:189 [inline]
       exit_to_user_mode_loop kernel/entry/common.c:175 [inline]
       exit_to_user_mode_prepare+0x160/0x190 kernel/entry/common.c:207
       __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline]
       syscall_exit_to_user_mode+0x20/0x40 kernel/entry/common.c:300
       do_syscall_64+0x50/0xd0 arch/x86/entry/common.c:86
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      write to 0xffff8881087d5886 of 1 bytes by task 1912 on cpu 1:
       fib6_info_hw_flags_set+0x155/0x3b0 net/ipv6/route.c:6230
       nsim_fib6_rt_hw_flags_set drivers/net/netdevsim/fib.c:668 [inline]
       nsim_fib6_rt_add drivers/net/netdevsim/fib.c:691 [inline]
       nsim_fib6_rt_insert drivers/net/netdevsim/fib.c:756 [inline]
       nsim_fib6_event drivers/net/netdevsim/fib.c:853 [inline]
       nsim_fib_event drivers/net/netdevsim/fib.c:886 [inline]
       nsim_fib_event_work+0x284f/0x2cf0 drivers/net/netdevsim/fib.c:1477
       process_one_work+0x3f6/0x960 kernel/workqueue.c:2307
       worker_thread+0x616/0xa70 kernel/workqueue.c:2454
       kthread+0x2c7/0x2e0 kernel/kthread.c:327
       ret_from_fork+0x1f/0x30
      
      value changed: 0x22 -> 0x2a
      
      Reported by Kernel Concurrency Sanitizer on:
      CPU: 1 PID: 1912 Comm: kworker/1:3 Not tainted 5.16.0-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Workqueue: events nsim_fib_event_work
      
      Fixes: 0c5fcf9e ("IPv6: Add "offload failed" indication to routes")
      Fixes: bb3c4ab9 ("ipv6: Add "offload" and "trap" indications to routes")
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Cc: Amit Cohen <amcohen@nvidia.com>
      Cc: Ido Schimmel <idosch@nvidia.com>
      Reported-by: Nsyzbot <syzkaller@googlegroups.com>
      Link: https://lore.kernel.org/r/20220216173217.3792411-2-eric.dumazet@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      d95d6320
  16. 11 2月, 2022 4 次提交
  17. 21 1月, 2022 1 次提交
    • E
      ipv6: annotate accesses to fn->fn_sernum · aafc2e32
      Eric Dumazet 提交于
      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 -> 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: c5cff856 ("ipv6: add rcu grace period before freeing fib6_node")
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Reported-by: Nsyzbot <syzkaller@googlegroups.com>
      Link: https://lore.kernel.org/r/20220120174112.1126644-1-eric.dumazet@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      aafc2e32
  18. 04 1月, 2022 2 次提交
  19. 31 12月, 2021 3 次提交
  20. 15 12月, 2021 1 次提交
    • E
      ipv6: use GFP_ATOMIC in rt6_probe() · 8b40a9d5
      Eric Dumazet 提交于
      syzbot reminded me that rt6_probe() can run from
      atomic contexts.
      
      stack backtrace:
      
      CPU: 1 PID: 7461 Comm: syz-executor.2 Not tainted 5.16.0-rc4-next-20211210-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       <IRQ>
       __dump_stack lib/dump_stack.c:88 [inline]
       dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
       print_usage_bug kernel/locking/lockdep.c:203 [inline]
       valid_state kernel/locking/lockdep.c:3945 [inline]
       mark_lock_irq kernel/locking/lockdep.c:4148 [inline]
       mark_lock.cold+0x61/0x8e kernel/locking/lockdep.c:4605
       mark_usage kernel/locking/lockdep.c:4500 [inline]
       __lock_acquire+0x11d5/0x54a0 kernel/locking/lockdep.c:4981
       lock_acquire kernel/locking/lockdep.c:5639 [inline]
       lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5604
       __fs_reclaim_acquire mm/page_alloc.c:4550 [inline]
       fs_reclaim_acquire+0x115/0x160 mm/page_alloc.c:4564
       might_alloc include/linux/sched/mm.h:253 [inline]
       slab_pre_alloc_hook mm/slab.h:739 [inline]
       slab_alloc_node mm/slub.c:3145 [inline]
       slab_alloc mm/slub.c:3239 [inline]
       kmem_cache_alloc_trace+0x3b/0x2c0 mm/slub.c:3256
       kmalloc include/linux/slab.h:581 [inline]
       kzalloc include/linux/slab.h:715 [inline]
       ref_tracker_alloc+0xe1/0x430 lib/ref_tracker.c:74
       netdev_tracker_alloc include/linux/netdevice.h:3860 [inline]
       dev_hold_track include/linux/netdevice.h:3877 [inline]
       rt6_probe net/ipv6/route.c:661 [inline]
       find_match.part.0+0xac9/0xd00 net/ipv6/route.c:752
       find_match net/ipv6/route.c:825 [inline]
       __find_rr_leaf+0x17f/0xd20 net/ipv6/route.c:826
       find_rr_leaf net/ipv6/route.c:847 [inline]
       rt6_select net/ipv6/route.c:891 [inline]
       fib6_table_lookup+0x649/0xa20 net/ipv6/route.c:2185
       ip6_pol_route+0x1c5/0x11e0 net/ipv6/route.c:2221
       pol_lookup_func include/net/ip6_fib.h:580 [inline]
       fib6_rule_lookup+0x52a/0x6f0 net/ipv6/fib6_rules.c:120
       ip6_route_output_flags_noref+0x2e2/0x380 net/ipv6/route.c:2629
       ip6_route_output_flags+0x72/0x320 net/ipv6/route.c:2642
       ip6_route_output include/net/ip6_route.h:98 [inline]
       ip6_dst_lookup_tail+0x5ab/0x1620 net/ipv6/ip6_output.c:1070
       ip6_dst_lookup_flow+0x8c/0x1d0 net/ipv6/ip6_output.c:1200
       geneve_get_v6_dst+0x46f/0x9a0 drivers/net/geneve.c:858
       geneve6_xmit_skb drivers/net/geneve.c:991 [inline]
       geneve_xmit+0x520/0x3530 drivers/net/geneve.c:1074
       __netdev_start_xmit include/linux/netdevice.h:4685 [inline]
       netdev_start_xmit include/linux/netdevice.h:4699 [inline]
       xmit_one net/core/dev.c:3473 [inline]
       dev_hard_start_xmit+0x1eb/0x920 net/core/dev.c:3489
       __dev_queue_xmit+0x2983/0x3640 net/core/dev.c:4112
       neigh_resolve_output net/core/neighbour.c:1522 [inline]
       neigh_resolve_output+0x50e/0x820 net/core/neighbour.c:1502
       neigh_output include/net/neighbour.h:541 [inline]
       ip6_finish_output2+0x56e/0x14f0 net/ipv6/ip6_output.c:126
       __ip6_finish_output net/ipv6/ip6_output.c:191 [inline]
       __ip6_finish_output+0x61e/0xe80 net/ipv6/ip6_output.c:170
       ip6_finish_output+0x32/0x200 net/ipv6/ip6_output.c:201
       NF_HOOK_COND include/linux/netfilter.h:296 [inline]
       ip6_output+0x1e4/0x530 net/ipv6/ip6_output.c:224
       dst_output include/net/dst.h:451 [inline]
       NF_HOOK include/linux/netfilter.h:307 [inline]
       ndisc_send_skb+0xa99/0x17f0 net/ipv6/ndisc.c:508
       ndisc_send_rs+0x12e/0x6f0 net/ipv6/ndisc.c:702
       addrconf_rs_timer+0x3f2/0x820 net/ipv6/addrconf.c:3898
       call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1421
       expire_timers kernel/time/timer.c:1466 [inline]
       __run_timers.part.0+0x675/0xa20 kernel/time/timer.c:1734
       __run_timers kernel/time/timer.c:1715 [inline]
       run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1747
       __do_softirq+0x29b/0x9c2 kernel/softirq.c:558
       invoke_softirq kernel/softirq.c:432 [inline]
       __irq_exit_rcu+0x123/0x180 kernel/softirq.c:637
       irq_exit_rcu+0x5/0x20 kernel/softirq.c:649
       sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1097
       </IRQ>
      
      Fixes: fb67510b ("ipv6: add net device refcount tracker to rt6_probe_deferred()")
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Reported-by: Nsyzbot <syzkaller@googlegroups.com>
      Link: https://lore.kernel.org/r/20211214025806.3456382-1-eric.dumazet@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      8b40a9d5
  21. 08 12月, 2021 1 次提交
  22. 07 12月, 2021 2 次提交
  23. 30 11月, 2021 1 次提交
  24. 22 11月, 2021 1 次提交
    • N
      net: ipv6: add fib6_nh_release_dsts stub · 8837cbbf
      Nikolay Aleksandrov 提交于
      We need a way to release a fib6_nh's per-cpu dsts when replacing
      nexthops otherwise we can end up with stale per-cpu dsts which hold net
      device references, so add a new IPv6 stub called fib6_nh_release_dsts.
      It must be used after an RCU grace period, so no new dsts can be created
      through a group's nexthop entry.
      Similar to fib6_nh_release it shouldn't be used if fib6_nh_init has failed
      so it doesn't need a dummy stub when IPv6 is not enabled.
      
      Fixes: 7bf4796d ("nexthops: add support for replace")
      Signed-off-by: NNikolay Aleksandrov <nikolay@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8837cbbf
  25. 19 11月, 2021 1 次提交
  26. 17 11月, 2021 1 次提交
  27. 28 10月, 2021 1 次提交
  28. 24 9月, 2021 1 次提交
  29. 30 8月, 2021 1 次提交
    • E
      ipv6: make exception cache less predictible · a00df2ca
      Eric Dumazet 提交于
      Even after commit 4785305c ("ipv6: use siphash in rt6_exception_hash()"),
      an attacker can still use brute force to learn some secrets from a victim
      linux host.
      
      One way to defeat these attacks is to make the max depth of the hash
      table bucket a random value.
      
      Before this patch, each bucket of the hash table used to store exceptions
      could contain 6 items under attack.
      
      After the patch, each bucket would contains a random number of items,
      between 6 and 10. The attacker can no longer infer secrets.
      
      This is slightly increasing memory size used by the hash table,
      we do not expect this to be a problem.
      
      Following patch is dealing with the same issue in IPv4.
      
      Fixes: 35732d01 ("ipv6: introduce a hash table to store dst cache")
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Reported-by: NKeyu Man <kman001@ucr.edu>
      Cc: Wei Wang <weiwan@google.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Reviewed-by: NDavid Ahern <dsahern@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a00df2ca
  30. 26 8月, 2021 1 次提交
  31. 05 8月, 2021 1 次提交
  32. 21 7月, 2021 1 次提交
  33. 20 7月, 2021 1 次提交