1. Feb 10, 2024
  2. Feb 09, 2024
    • Paolo Abeni's avatar
      selftests: net: add more missing kernel config · 02d9009f
      Paolo Abeni authored
      
      
      The reuseport_addr_any.sh is currently skipping DCCP tests and
      pmtu.sh is skipping all the FOU/GUE related cases: add the missing
      options.
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/38d3ca7f909736c1aef56e6244d67c82a9bba6ff.1707326987.git.pabeni@redhat.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      02d9009f
    • Parav Pandit's avatar
      devlink: Fix command annotation documentation · 4ab18af4
      Parav Pandit authored
      Command example string is not read as command.
      Fix command annotation.
      
      Fixes: a8ce7b26
      
       ("devlink: Expose port function commands to control migratable")
      Signed-off-by: default avatarParav Pandit <parav@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Link: https://lore.kernel.org/r/20240206161717.466653-1-parav@nvidia.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      4ab18af4
    • Magnus Karlsson's avatar
      bonding: do not report NETDEV_XDP_ACT_XSK_ZEROCOPY · 9b0ed890
      Magnus Karlsson authored
      Do not report the XDP capability NETDEV_XDP_ACT_XSK_ZEROCOPY as the
      bonding driver does not support XDP and AF_XDP in zero-copy mode even
      if the real NIC drivers do.
      
      Note that the driver used to report everything as supported before a
      device was bonded. Instead of just masking out the zero-copy support
      from this, have the driver report that no XDP feature is supported
      until a real device is bonded. This seems to be more truthful as it is
      the real drivers that decide what XDP features are supported.
      
      Fixes: cb9e6e58
      
       ("bonding: add xdp_features support")
      Reported-by: default avatarPrashant Batra <prbatra.mail@gmail.com>
      Link: https://lore.kernel.org/all/CAJ8uoz2ieZCopgqTvQ9ZY6xQgTbujmC6XkMTamhp68O-h_-rLg@mail.gmail.com/T/
      
      
      Signed-off-by: default avatarMagnus Karlsson <magnus.karlsson@intel.com>
      Reviewed-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
      Link: https://lore.kernel.org/r/20240207084737.20890-1-magnus.karlsson@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9b0ed890
    • Chuck Lever's avatar
      net/handshake: Fix handshake_req_destroy_test1 · 4e1d71ca
      Chuck Lever authored
      Recently, handshake_req_destroy_test1 started failing:
      
      Expected handshake_req_destroy_test == req, but
          handshake_req_destroy_test == 0000000000000000
          req == 0000000060f99b40
      not ok 11 req_destroy works
      
      This is because "sock_release(sock)" was replaced with "fput(filp)"
      to address a memory leak. Note that sock_release() is synchronous
      but fput() usually delays the final close and clean-up.
      
      The delay is not consequential in the other cases that were changed
      but handshake_req_destroy_test1 is testing that handshake_req_cancel()
      followed by closing the file actually does call the ->hp_destroy
      method. Thus the PTR_EQ test at the end has to be sure that the
      final close is complete before it checks the pointer.
      
      We cannot use a completion here because if ->hp_destroy is never
      called (ie, there is an API bug) then the test will hang.
      
      Reported by: Guenter Roeck <linux@roeck-us.net>
      Closes: https://lore.kernel.org/netdev/ZcKDd1to4MPANCrn@tissot.1015granger.net/T/#mac5c6299f86799f1c71776f3a07f9c566c7c3c40
      Fixes: 4a0f07d7
      
       ("net/handshake: Fix memory leak in __sock_create() and sock_alloc_file()")
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Link: https://lore.kernel.org/r/170724699027.91401.7839730697326806733.stgit@oracle-102.nfsv4bat.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      4e1d71ca
    • Jiri Pirko's avatar
      net/mlx5: DPLL, Fix possible use after free after delayed work timer triggers · aa1eec2f
      Jiri Pirko authored
      I managed to hit following use after free warning recently:
      
      [ 2169.711665] ==================================================================
      [ 2169.714009] BUG: KASAN: slab-use-after-free in __run_timers.part.0+0x179/0x4c0
      [ 2169.716293] Write of size 8 at addr ffff88812b326a70 by task swapper/4/0
      
      [ 2169.719022] CPU: 4 PID: 0 Comm: swapper/4 Not tainted 6.8.0-rc2jiri+ #2
      [ 2169.720974] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
      [ 2169.722457] Call Trace:
      [ 2169.722756]  <IRQ>
      [ 2169.723024]  dump_stack_lvl+0x58/0xb0
      [ 2169.723417]  print_report+0xc5/0x630
      [ 2169.723807]  ? __virt_addr_valid+0x126/0x2b0
      [ 2169.724268]  kasan_report+0xbe/0xf0
      [ 2169.724667]  ? __run_timers.part.0+0x179/0x4c0
      [ 2169.725116]  ? __run_timers.part.0+0x179/0x4c0
      [ 2169.725570]  __run_timers.part.0+0x179/0x4c0
      [ 2169.726003]  ? call_timer_fn+0x320/0x320
      [ 2169.726404]  ? lock_downgrade+0x3a0/0x3a0
      [ 2169.726820]  ? kvm_clock_get_cycles+0x14/0x20
      [ 2169.727257]  ? ktime_get+0x92/0x150
      [ 2169.727630]  ? lapic_next_deadline+0x35/0x60
      [ 2169.728069]  run_timer_softirq+0x40/0x80
      [ 2169.728475]  __do_softirq+0x1a1/0x509
      [ 2169.728866]  irq_exit_rcu+0x95/0xc0
      [ 2169.729241]  sysvec_apic_timer_interrupt+0x6b/0x80
      [ 2169.729718]  </IRQ>
      [ 2169.729993]  <TASK>
      [ 2169.730259]  asm_sysvec_apic_timer_interrupt+0x16/0x20
      [ 2169.730755] RIP: 0010:default_idle+0x13/0x20
      [ 2169.731190] Code: c0 08 00 00 00 4d 29 c8 4c 01 c7 4c 29 c2 e9 72 ff ff ff cc cc cc cc 8b 05 9a 7f 1f 02 85 c0 7e 07 0f 00 2d cf 69 43 00 fb f4 <fa> c3 66 66 2e 0f 1f 84 00 00 00 00 00 65 48 8b 04 25 c0 93 04 00
      [ 2169.732759] RSP: 0018:ffff888100dbfe10 EFLAGS: 00000242
      [ 2169.733264] RAX: 0000000000000001 RBX: ffff888100d9c200 RCX: ffffffff8241bd62
      [ 2169.733925] RDX: ffffed109a848b15 RSI: 0000000000000004 RDI: ffffffff8127ac55
      [ 2169.734566] RBP: 0000000000000004 R08: 0000000000000000 R09: ffffed109a848b14
      [ 2169.735200] R10: ffff8884d42458a3 R11: 000000000000ba7e R12: ffffffff83d7d3a0
      [ 2169.735835] R13: 1ffff110201b7fc6 R14: 0000000000000000 R15: ffff888100d9c200
      [ 2169.736478]  ? ct_kernel_exit.constprop.0+0xa2/0xc0
      [ 2169.736954]  ? do_idle+0x285/0x290
      [ 2169.737323]  default_idle_call+0x63/0x90
      [ 2169.737730]  do_idle+0x285/0x290
      [ 2169.738089]  ? arch_cpu_idle_exit+0x30/0x30
      [ 2169.738511]  ? mark_held_locks+0x1a/0x80
      [ 2169.738917]  ? lockdep_hardirqs_on_prepare+0x12e/0x200
      [ 2169.739417]  cpu_startup_entry+0x30/0x40
      [ 2169.739825]  start_secondary+0x19a/0x1c0
      [ 2169.740229]  ? set_cpu_sibling_map+0xbd0/0xbd0
      [ 2169.740673]  secondary_startup_64_no_verify+0x15d/0x16b
      [ 2169.741179]  </TASK>
      
      [ 2169.741686] Allocated by task 1098:
      [ 2169.742058]  kasan_save_stack+0x1c/0x40
      [ 2169.742456]  kasan_save_track+0x10/0x30
      [ 2169.742852]  __kasan_kmalloc+0x83/0x90
      [ 2169.743246]  mlx5_dpll_probe+0xf5/0x3c0 [mlx5_dpll]
      [ 2169.743730]  auxiliary_bus_probe+0x62/0xb0
      [ 2169.744148]  really_probe+0x127/0x590
      [ 2169.744534]  __driver_probe_device+0xd2/0x200
      [ 2169.744973]  device_driver_attach+0x6b/0xf0
      [ 2169.745402]  bind_store+0x90/0xe0
      [ 2169.745761]  kernfs_fop_write_iter+0x1df/0x2a0
      [ 2169.746210]  vfs_write+0x41f/0x790
      [ 2169.746579]  ksys_write+0xc7/0x160
      [ 2169.746947]  do_syscall_64+0x6f/0x140
      [ 2169.747333]  entry_SYSCALL_64_after_hwframe+0x46/0x4e
      
      [ 2169.748049] Freed by task 1220:
      [ 2169.748393]  kasan_save_stack+0x1c/0x40
      [ 2169.748789]  kasan_save_track+0x10/0x30
      [ 2169.749188]  kasan_save_free_info+0x3b/0x50
      [ 2169.749621]  poison_slab_object+0x106/0x180
      [ 2169.750044]  __kasan_slab_free+0x14/0x50
      [ 2169.750451]  kfree+0x118/0x330
      [ 2169.750792]  mlx5_dpll_remove+0xf5/0x110 [mlx5_dpll]
      [ 2169.751271]  auxiliary_bus_remove+0x2e/0x40
      [ 2169.751694]  device_release_driver_internal+0x24b/0x2e0
      [ 2169.752191]  unbind_store+0xa6/0xb0
      [ 2169.752563]  kernfs_fop_write_iter+0x1df/0x2a0
      [ 2169.753004]  vfs_write+0x41f/0x790
      [ 2169.753381]  ksys_write+0xc7/0x160
      [ 2169.753750]  do_syscall_64+0x6f/0x140
      [ 2169.754132]  entry_SYSCALL_64_after_hwframe+0x46/0x4e
      
      [ 2169.754847] Last potentially related work creation:
      [ 2169.755315]  kasan_save_stack+0x1c/0x40
      [ 2169.755709]  __kasan_record_aux_stack+0x9b/0xf0
      [ 2169.756165]  __queue_work+0x382/0x8f0
      [ 2169.756552]  call_timer_fn+0x126/0x320
      [ 2169.756941]  __run_timers.part.0+0x2ea/0x4c0
      [ 2169.757376]  run_timer_softirq+0x40/0x80
      [ 2169.757782]  __do_softirq+0x1a1/0x509
      
      [ 2169.758387] Second to last potentially related work creation:
      [ 2169.758924]  kasan_save_stack+0x1c/0x40
      [ 2169.759322]  __kasan_record_aux_stack+0x9b/0xf0
      [ 2169.759773]  __queue_work+0x382/0x8f0
      [ 2169.760156]  call_timer_fn+0x126/0x320
      [ 2169.760550]  __run_timers.part.0+0x2ea/0x4c0
      [ 2169.760978]  run_timer_softirq+0x40/0x80
      [ 2169.761381]  __do_softirq+0x1a1/0x509
      
      [ 2169.761998] The buggy address belongs to the object at ffff88812b326a00
                      which belongs to the cache kmalloc-256 of size 256
      [ 2169.763061] The buggy address is located 112 bytes inside of
                      freed 256-byte region [ffff88812b326a00, ffff88812b326b00)
      
      [ 2169.764346] The buggy address belongs to the physical page:
      [ 2169.764866] page:000000000f2b1e89 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x12b324
      [ 2169.765731] head:000000000f2b1e89 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0
      [ 2169.766484] anon flags: 0x200000000000840(slab|head|node=0|zone=2)
      [ 2169.767048] page_type: 0xffffffff()
      [ 2169.767422] raw: 0200000000000840 ffff888100042b40 0000000000000000 dead000000000001
      [ 2169.768183] raw: 0000000000000000 0000000000200020 00000001ffffffff 0000000000000000
      [ 2169.768899] page dumped because: kasan: bad access detected
      
      [ 2169.769649] Memory state around the buggy address:
      [ 2169.770116]  ffff88812b326900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      [ 2169.770805]  ffff88812b326980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      [ 2169.771485] >ffff88812b326a00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [ 2169.772173]                                                              ^
      [ 2169.772787]  ffff88812b326a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [ 2169.773477]  ffff88812b326b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      [ 2169.774160] ==================================================================
      [ 2169.774845] ==================================================================
      
      I didn't manage to reproduce it. Though the issue seems to be obvious.
      There is a chance that the mlx5_dpll_remove() calls
      cancel_delayed_work() when the work runs and manages to re-arm itself.
      In that case, after delay timer triggers next attempt to queue it,
      it works with freed memory.
      
      Fix this by using cancel_delayed_work_sync() instead which makes sure
      that work is done when it returns.
      
      Fixes: 496fd0a2
      
       ("mlx5: Implement SyncE support using DPLL infrastructure")
      Signed-off-by: default avatarJiri Pirko <jiri@nvidia.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Link: https://lore.kernel.org/r/20240206164328.360313-1-jiri@resnulli.us
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      aa1eec2f
    • Jiri Pirko's avatar
      dpll: fix possible deadlock during netlink dump operation · 53c0441d
      Jiri Pirko authored
      Recently, I've been hitting following deadlock warning during dpll pin
      dump:
      
      [52804.637962] ======================================================
      [52804.638536] WARNING: possible circular locking dependency detected
      [52804.639111] 6.8.0-rc2jiri+ #1 Not tainted
      [52804.639529] ------------------------------------------------------
      [52804.640104] python3/2984 is trying to acquire lock:
      [52804.640581] ffff88810e642678 (nlk_cb_mutex-GENERIC){+.+.}-{3:3}, at: netlink_dump+0xb3/0x780
      [52804.641417]
                     but task is already holding lock:
      [52804.642010] ffffffff83bde4c8 (dpll_lock){+.+.}-{3:3}, at: dpll_lock_dumpit+0x13/0x20
      [52804.642747]
                     which lock already depends on the new lock.
      
      [52804.643551]
                     the existing dependency chain (in reverse order) is:
      [52804.644259]
                     -> #1 (dpll_lock){+.+.}-{3:3}:
      [52804.644836]        lock_acquire+0x174/0x3e0
      [52804.645271]        __mutex_lock+0x119/0x1150
      [52804.645723]        dpll_lock_dumpit+0x13/0x20
      [52804.646169]        genl_start+0x266/0x320
      [52804.646578]        __netlink_dump_start+0x321/0x450
      [52804.647056]        genl_family_rcv_msg_dumpit+0x155/0x1e0
      [52804.647575]        genl_rcv_msg+0x1ed/0x3b0
      [52804.648001]        netlink_rcv_skb+0xdc/0x210
      [52804.648440]        genl_rcv+0x24/0x40
      [52804.648831]        netlink_unicast+0x2f1/0x490
      [52804.649290]        netlink_sendmsg+0x36d/0x660
      [52804.649742]        __sock_sendmsg+0x73/0xc0
      [52804.650165]        __sys_sendto+0x184/0x210
      [52804.650597]        __x64_sys_sendto+0x72/0x80
      [52804.651045]        do_syscall_64+0x6f/0x140
      [52804.651474]        entry_SYSCALL_64_after_hwframe+0x46/0x4e
      [52804.652001]
                     -> #0 (nlk_cb_mutex-GENERIC){+.+.}-{3:3}:
      [52804.652650]        check_prev_add+0x1ae/0x1280
      [52804.653107]        __lock_acquire+0x1ed3/0x29a0
      [52804.653559]        lock_acquire+0x174/0x3e0
      [52804.653984]        __mutex_lock+0x119/0x1150
      [52804.654423]        netlink_dump+0xb3/0x780
      [52804.654845]        __netlink_dump_start+0x389/0x450
      [52804.655321]        genl_family_rcv_msg_dumpit+0x155/0x1e0
      [52804.655842]        genl_rcv_msg+0x1ed/0x3b0
      [52804.656272]        netlink_rcv_skb+0xdc/0x210
      [52804.656721]        genl_rcv+0x24/0x40
      [52804.657119]        netlink_unicast+0x2f1/0x490
      [52804.657570]        netlink_sendmsg+0x36d/0x660
      [52804.658022]        __sock_sendmsg+0x73/0xc0
      [52804.658450]        __sys_sendto+0x184/0x210
      [52804.658877]        __x64_sys_sendto+0x72/0x80
      [52804.659322]        do_syscall_64+0x6f/0x140
      [52804.659752]        entry_SYSCALL_64_after_hwframe+0x46/0x4e
      [52804.660281]
                     other info that might help us debug this:
      
      [52804.661077]  Possible unsafe locking scenario:
      
      [52804.661671]        CPU0                    CPU1
      [52804.662129]        ----                    ----
      [52804.662577]   lock(dpll_lock);
      [52804.662924]                                lock(nlk_cb_mutex-GENERIC);
      [52804.663538]                                lock(dpll_lock);
      [52804.664073]   lock(nlk_cb_mutex-GENERIC);
      [52804.664490]
      
      The issue as follows: __netlink_dump_start() calls control->start(cb)
      with nlk->cb_mutex held. In control->start(cb) the dpll_lock is taken.
      Then nlk->cb_mutex is released and taken again in netlink_dump(), while
      dpll_lock still being held. That leads to ABBA deadlock when another
      CPU races with the same operation.
      
      Fix this by moving dpll_lock taking into dumpit() callback which ensures
      correct lock taking order.
      
      Fixes: 9d71b54b
      
       ("dpll: netlink: Add DPLL framework base functions")
      Signed-off-by: default avatarJiri Pirko <jiri@nvidia.com>
      Reviewed-by: default avatarArkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
      Link: https://lore.kernel.org/r/20240207115902.371649-1-jiri@resnulli.us
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      53c0441d
    • Linus Torvalds's avatar
      Merge tag 'net-6.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 1f719a2f
      Linus Torvalds authored
      Pull networking fixes from Paolo Abeni:
       "Including fixes from WiFi and netfilter.
      
        Current release - regressions:
      
         - nic: intel: fix old compiler regressions
      
         - netfilter: ipset: missing gc cancellations fixed
      
        Current release - new code bugs:
      
         - netfilter: ctnetlink: fix filtering for zone 0
      
        Previous releases - regressions:
      
         - core: fix from address in memcpy_to_iter_csum()
      
         - netfilter: nfnetlink_queue: un-break NF_REPEAT
      
         - af_unix: fix memory leak for dead unix_(sk)->oob_skb in GC.
      
         - devlink: avoid potential loop in devlink_rel_nested_in_notify_work()
      
         - iwlwifi:
             - mvm: fix a battery life regression
             - fix double-free bug
      
         - mac80211: fix waiting for beacons logic
      
         - nic: nfp: flower: prevent re-adding mac index for bonded port
      
        Previous releases - always broken:
      
         - rxrpc: fix generation of serial numbers to skip zero
      
         - tipc: check the bearer type before calling tipc_udp_nl_bearer_add()
      
         - tunnels: fix out of bounds access when building IPv6 PMTU error
      
         - nic: hv_netvsc: register VF in netvsc_probe if NET_DEVICE_REGISTER
           missed
      
         - nic: atlantic: fix DMA mapping for PTP hwts ring
      
        Misc:
      
         - selftests: more fixes to deal with very slow hosts"
      
      * tag 'net-6.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (80 commits)
        netfilter: nft_set_pipapo: remove scratch_aligned pointer
        netfilter: nft_set_pipapo: add helper to release pcpu scratch area
        netfilter: nft_set_pipapo: store index in scratch maps
        netfilter: nft_set_rbtree: skip end interval element from gc
        netfilter: nfnetlink_queue: un-break NF_REPEAT
        netfilter: nf_tables: use timestamp to check for set element timeout
        netfilter: nft_ct: reject direction for ct id
        netfilter: ctnetlink: fix filtering for zone 0
        s390/qeth: Fix potential loss of L3-IP@ in case of network issues
        netfilter: ipset: Missing gc cancellations fixed
        octeontx2-af: Initialize maps.
        net: ethernet: ti: cpsw: enable mac_managed_pm to fix mdio
        net: ethernet: ti: cpsw_new: enable mac_managed_pm to fix mdio
        netfilter: nft_set_pipapo: remove static in nft_pipapo_get()
        netfilter: nft_compat: restrict match/target protocol to u16
        netfilter: nft_compat: reject unused compat flag
        netfilter: nft_compat: narrow down revision to unsigned 8-bits
        net: intel: fix old compiler regressions
        MAINTAINERS: Maintainer change for rds
        selftests: cmsg_ipv6: repeat the exact packet
        ...
      1f719a2f
    • Linus Torvalds's avatar
      Merge tag 'pinctrl-v6.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl · b0d5d0f7
      Linus Torvalds authored
      Pull pinctrl fix from Linus Walleij:
       "A single fix for the AMD driver which affects developer laptops, the
        pinctrl/GPIO driver won't probe on some systems"
      
      * tag 'pinctrl-v6.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
        pinctrl: amd: Add IRQF_ONESHOT to the interrupt request
      b0d5d0f7
  3. Feb 08, 2024