1. 07 Aug, 2024 1 commit
  2. 06 Aug, 2024 1 commit
  3. 05 Aug, 2024 5 commits
  4. 04 Aug, 2024 1 commit
    • Dmitry Safonov's avatar
      net/tcp: Disable TCP-AO static key after RCU grace period · 14ab4792
      Dmitry Safonov authored
      The lifetime of TCP-AO static_key is the same as the last
      tcp_ao_info. On the socket destruction tcp_ao_info ceases to be
      with RCU grace period, while tcp-ao static branch is currently deferred
      destructed. The static key definition is
      : DEFINE_STATIC_KEY_DEFERRED_FALSE(tcp_ao_needed, HZ);
      
      which means that if RCU grace period is delayed by more than a second
      and tcp_ao_needed is in the process of disablement, other CPUs may
      yet see tcp_ao_info which atent dead, but soon-to-be.
      And that breaks the assumption of static_key_fast_inc_not_disabled().
      
      See the comment near the definition:
      > * The caller must make sure that the static key can't get disabled while
      > * in this function. It doesn't patch jump labels, only adds a user to
      > * an already enabled static key.
      
      Originally it was introduced in commit eb8c5072 ("jump_label:
      Prevent key->enabled int overflow"), which is needed for the atomic
      contexts, one of which would be the creation of a full socket from a
      request socket. In that atomic context, it's known by the presence
      of the key (md5/ao) that the static branch is already enabled.
      So, the ref counter for that static branch is just incremented
      instead of holding the proper mutex.
      static_key_fast_inc_not_disabled() is just a helper for such usage
      case. But it must not be used if the static branch could get disabled
      in parallel as it's not protected by jump_label_mutex and as a result,
      races with jump_label_update() implementation details.
      
      Happened on netdev test-bot[1], so not a theoretical issue:
      
      [] jump_label: Fatal kernel bug, unexpected op at tcp_inbound_hash+0x1a7/0x870 [ffffffffa8c4e9b7] (eb 50 0f 1f 44 != 66 90 0f 1f 00)) size:2 type:1
      [] ------------[ cut here ]------------
      [] kernel BUG at arch/x86/kernel/jump_label.c:73!
      [] Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN NOPTI
      [] CPU: 3 PID: 243 Comm: kworker/3:3 Not tainted 6.10.0-virtme #1
      [] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014
      [] Workqueue: events jump_label_update_timeout
      [] RIP: 0010:__jump_label_patch+0x2f6/0x350
      ...
      [] Call Trace:
      []  <TASK>
      []  arch_jump_label_transform_queue+0x6c/0x110
      []  __jump_label_update+0xef/0x350
      []  __static_key_slow_dec_cpuslocked.part.0+0x3c/0x60
      []  jump_label_update_timeout+0x2c/0x40
      []  process_one_work+0xe3b/0x1670
      []  worker_thread+0x587/0xce0
      []  kthread+0x28a/0x350
      []  ret_from_fork+0x31/0x70
      []  ret_from_fork_asm+0x1a/0x30
      []  </TASK>
      [] Modules linked in: veth
      [] ---[ end trace 0000000000000000 ]---
      [] RIP: 0010:__jump_label_patch+0x2f6/0x350
      
      [1]: https://netdev-3.bots.linux.dev/vmksft-tcp-ao-dbg/results/696681/5-connect-deny-ipv6/stderr
      
      Cc: stable@kernel.org
      Fixes: 67fa83f7 ("net/tcp: Add static_key for TCP-AO")
      Signed-off-by: default avatarDmitry Safonov <0x7f454c46@gmail.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      14ab4792
  5. 02 Aug, 2024 12 commits
    • Praveen Kaligineedi's avatar
      gve: Fix use of netif_carrier_ok() · fba917b1
      Praveen Kaligineedi authored
      GVE driver wrongly relies on netif_carrier_ok() to check the
      interface administrative state when resources are being
      allocated/deallocated for queue(s). netif_carrier_ok() needs
      to be replaced with netif_running() for all such cases.
      
      Administrative state is the result of "ip link set dev <dev>
      up/down". It reflects whether the administrator wants to use
      the device for traffic and the corresponding resources have
      been allocated.
      
      Fixes: 5f08cd3d ("gve: Alloc before freeing when adjusting queues")
      Signed-off-by: default avatarPraveen Kaligineedi <pkaligineedi@google.com>
      Reviewed-by: default avatarShailend Chand <shailend@google.com>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Link: https://patch.msgid.link/20240801205619.987396-1-pkaligineedi@google.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      fba917b1
    • Kyle Swenson's avatar
      net: pse-pd: tps23881: Fix the device ID check · 89108cb5
      Kyle Swenson authored
      The DEVID register contains two pieces of information: the device ID in
      the upper nibble, and the silicon revision number in the lower nibble.
      The driver should work fine with any silicon revision, so let's mask
      that out in the device ID check.
      
      Fixes: 20e6d190 ("net: pse-pd: Add TI TPS23881 PSE controller driver")
      Signed-off-by: default avatarKyle Swenson <kyle.swenson@est.tech>
      Reviewed-by: default avatarThomas Petazzoni <thomas.petazzoni@bootlin.com>
      Acked-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Link: https://patch.msgid.link/20240731154152.4020668-1-kyle.swenson@est.techSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      89108cb5
    • Kuniyuki Iwashima's avatar
      sctp: Fix null-ptr-deref in reuseport_add_sock(). · 9ab0faa7
      Kuniyuki Iwashima authored
      syzbot reported a null-ptr-deref while accessing sk2->sk_reuseport_cb in
      reuseport_add_sock(). [0]
      
      The repro first creates a listener with SO_REUSEPORT.  Then, it creates
      another listener on the same port and concurrently closes the first
      listener.
      
      The second listen() calls reuseport_add_sock() with the first listener as
      sk2, where sk2->sk_reuseport_cb is not expected to be cleared concurrently,
      but the close() does clear it by reuseport_detach_sock().
      
      The problem is SCTP does not properly synchronise reuseport_alloc(),
      reuseport_add_sock(), and reuseport_detach_sock().
      
      The caller of reuseport_alloc() and reuseport_{add,detach}_sock() must
      provide synchronisation for sockets that are classified into the same
      reuseport group.
      
      Otherwise, such sockets form multiple identical reuseport groups, and
      all groups except one would be silently dead.
      
        1. Two sockets call listen() concurrently
        2. No socket in the same group found in sctp_ep_hashtable[]
        3. Two sockets call reuseport_alloc() and form two reuseport groups
        4. Only one group hit first in __sctp_rcv_lookup_endpoint() receives
            incoming packets
      
      Also, the reported null-ptr-deref could occur.
      
      TCP/UDP guarantees that would not happen by holding the hash bucket lock.
      
      Let's apply the locking strategy to __sctp_hash_endpoint() and
      __sctp_unhash_endpoint().
      
      [0]:
      Oops: general protection fault, probably for non-canonical address 0xdffffc0000000002: 0000 [#1] PREEMPT SMP KASAN PTI
      KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017]
      CPU: 1 UID: 0 PID: 10230 Comm: syz-executor119 Not tainted 6.10.0-syzkaller-12585-g301927d2 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024
      RIP: 0010:reuseport_add_sock+0x27e/0x5e0 net/core/sock_reuseport.c:350
      Code: 00 0f b7 5d 00 bf 01 00 00 00 89 de e8 1b a4 ff f7 83 fb 01 0f 85 a3 01 00 00 e8 6d a0 ff f7 49 8d 7e 12 48 89 f8 48 c1 e8 03 <42> 0f b6 04 28 84 c0 0f 85 4b 02 00 00 41 0f b7 5e 12 49 8d 7e 14
      RSP: 0018:ffffc9000b947c98 EFLAGS: 00010202
      RAX: 0000000000000002 RBX: ffff8880252ddf98 RCX: ffff888079478000
      RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000012
      RBP: 0000000000000001 R08: ffffffff8993e18d R09: 1ffffffff1fef385
      R10: dffffc0000000000 R11: fffffbfff1fef386 R12: ffff8880252ddac0
      R13: dffffc0000000000 R14: 0000000000000000 R15: 0000000000000000
      FS:  00007f24e45b96c0(0000) GS:ffff8880b9300000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007ffcced5f7b8 CR3: 00000000241be000 CR4: 00000000003506f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
       DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <TASK>
       __sctp_hash_endpoint net/sctp/input.c:762 [inline]
       sctp_hash_endpoint+0x52a/0x600 net/sctp/input.c:790
       sctp_listen_start net/sctp/socket.c:8570 [inline]
       sctp_inet_listen+0x767/0xa20 net/sctp/socket.c:8625
       __sys_listen_socket net/socket.c:1883 [inline]
       __sys_listen+0x1b7/0x230 net/socket.c:1894
       __do_sys_listen net/socket.c:1902 [inline]
       __se_sys_listen net/socket.c:1900 [inline]
       __x64_sys_listen+0x5a/0x70 net/socket.c:1900
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
      RIP: 0033:0x7f24e46039b9
      Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 91 1a 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007f24e45b9228 EFLAGS: 00000246 ORIG_RAX: 0000000000000032
      RAX: ffffffffffffffda RBX: 00007f24e468e428 RCX: 00007f24e46039b9
      RDX: 00007f24e46039b9 RSI: 0000000000000003 RDI: 0000000000000004
      RBP: 00007f24e468e420 R08: 00007f24e45b96c0 R09: 00007f24e45b96c0
      R10: 00007f24e45b96c0 R11: 0000000000000246 R12: 00007f24e468e42c
      R13: 00007f24e465a5dc R14: 0020000000000001 R15: 00007ffcced5f7d8
       </TASK>
      Modules linked in:
      
      Fixes: 6ba84574 ("sctp: process sk_reuseport in sctp_get_port_local")
      Reported-by: syzbot+e6979a5d2f10ecb700e4@syzkaller.appspotmail.com
      Closes: https://syzkaller.appspot.com/bug?extid=e6979a5d2f10ecb700e4
      Tested-by: syzbot+e6979a5d2f10ecb700e4@syzkaller.appspotmail.com
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Acked-by: default avatarXin Long <lucien.xin@gmail.com>
      Link: https://patch.msgid.link/20240731234624.94055-1-kuniyu@amazon.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9ab0faa7
    • Stephen Hemminger's avatar
      MAINTAINERS: update status of sky2 and skge drivers · eeef5f18
      Stephen Hemminger authored
      The old SysKonnect NIc's are not used or actively maintained anymore.
      My sky2 NIC's are all in box in back corner of attic.
      Signed-off-by: default avatarStephen Hemminger <stephen@networkplumber.org>
      Link: https://patch.msgid.link/20240801162930.212299-1-stephen@networkplumber.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      eeef5f18
    • Jakub Kicinski's avatar
      Merge branch 'mptcp-fix-endpoints-with-signal-and-subflow-flags' · 16dc75e5
      Jakub Kicinski authored
      Matthieu Baerts says:
      
      ====================
      mptcp: fix endpoints with 'signal' and 'subflow' flags
      
      When looking at improving the user experience around the MPTCP endpoints
      setup, I noticed that setting an endpoint with both the 'signal' and the
      'subflow' flags -- as it has been done in the past by users according to
      bug reports we got -- was resulting on only announcing the endpoint, but
      not using it to create subflows: the 'subflow' flag was then ignored.
      
      My initial thought was to modify IPRoute2 to warn the user when the two
      flags were set, but it doesn't sound normal to ignore one of them. I
      then looked at modifying the kernel not to allow having the two flags
      set, but when discussing about that with Mat, we thought it was maybe
      not ideal to do that, as there might be use-cases, we might break some
      configs. Then I saw it was working before v5.17. So instead, I fixed the
      support on the kernel side (patch 5) using Paolo's suggestion. This also
      includes a fix on the options side (patch 1: for v5.11+), an explicit
      deny of some options combinations (patch 2: for v5.18+), and some
      refactoring (patches 3 and 4) to ease the inclusion of the patch 5.
      
      While at it, I added a new selftest (patch 7) to validate this case --
      including a modification of the chk_add_nr helper to inverse the sides
      were the counters are checked (patch 6) -- and allowed ADD_ADDR echo
      just after the MP_JOIN 3WHS.
      
      The selftests modification have the same Fixes tag as the previous
      commit, but no 'Cc: Stable': if the backport can work, that's good --
      but it still need to be verified by running the selftests -- if not, no
      need to worry, many CIs will use the selftests from the last stable
      version to validate previous stable releases.
      ====================
      
      Link: https://patch.msgid.link/20240731-upstream-net-20240731-mptcp-endp-subflow-signal-v1-0-c8a9b036493b@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      16dc75e5
    • Matthieu Baerts (NGI0)'s avatar
      selftests: mptcp: join: test both signal & subflow · 4d2868b5
      Matthieu Baerts (NGI0) authored
      It should be quite uncommon to set both the subflow and the signal
      flags: the initiator of the connection is typically the one creating new
      subflows, not the other peer, then no need to announce additional local
      addresses, and use it to create subflows.
      
      But some people might be confused about the flags, and set both "just to
      be sure at least the right one is set". To verify the previous fix, and
      avoid future regressions, this specific case is now validated: the
      client announces a new address, and initiates a new subflow from the
      same address.
      
      While working on this, another bug has been noticed, where the client
      reset the new subflow because an ADD_ADDR echo got received as the 3rd
      ACK: this new test also explicitly checks that no RST have been sent by
      the client and server.
      
      The 'Fixes' tag here below is the same as the one from the previous
      commit: this patch here is not fixing anything wrong in the selftests,
      but it validates the previous fix for an issue introduced by this commit
      ID.
      
      Fixes: 86e39e04 ("mptcp: keep track of local endpoint still available for each msk")
      Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Link: https://patch.msgid.link/20240731-upstream-net-20240731-mptcp-endp-subflow-signal-v1-7-c8a9b036493b@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      4d2868b5
    • Matthieu Baerts (NGI0)'s avatar
      selftests: mptcp: join: ability to invert ADD_ADDR check · bec1f3b1
      Matthieu Baerts (NGI0) authored
      In the following commit, the client will initiate the ADD_ADDR, instead
      of the server. We need to way to verify the ADD_ADDR have been correctly
      sent.
      
      Note: the default expected counters for when the port number is given
      are never changed by the caller, no need to accept them as parameter
      then.
      
      The 'Fixes' tag here below is the same as the one from the previous
      commit: this patch here is not fixing anything wrong in the selftests,
      but it validates the previous fix for an issue introduced by this commit
      ID.
      
      Fixes: 86e39e04 ("mptcp: keep track of local endpoint still available for each msk")
      Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Link: https://patch.msgid.link/20240731-upstream-net-20240731-mptcp-endp-subflow-signal-v1-6-c8a9b036493b@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      bec1f3b1
    • Matthieu Baerts (NGI0)'s avatar
      mptcp: pm: do not ignore 'subflow' if 'signal' flag is also set · 85df533a
      Matthieu Baerts (NGI0) authored
      Up to the 'Fixes' commit, having an endpoint with both the 'signal' and
      'subflow' flags, resulted in the creation of a subflow and an address
      announcement using the address linked to this endpoint. After this
      commit, only the address announcement was done, ignoring the 'subflow'
      flag.
      
      That's because the same bitmap is used for the two flags. It is OK to
      keep this single bitmap, the already selected local endpoint simply have
      to be re-used, but not via select_local_address() not to look at the
      just modified bitmap.
      
      Note that it is unusual to set the two flags together: creating a new
      subflow using a new local address will implicitly advertise it to the
      other peer. So in theory, no need to advertise it explicitly as well.
      Maybe there are use-cases -- the subflow might not reach the other peer
      that way, we can ask the other peer to try initiating the new subflow
      without delay -- or very likely the user is confused, and put both flags
      "just to be sure at least the right one is set". Still, if it is
      allowed, the kernel should do what has been asked: using this endpoint
      to announce the address and to create a new subflow from it.
      
      An alternative is to forbid the use of the two flags together, but
      that's probably too late, there are maybe use-cases, and it was working
      before. This patch will avoid people complaining subflows are not
      created using the endpoint they added with the 'subflow' and 'signal'
      flag.
      
      Note that with the current patch, the subflow might not be created in
      some corner cases, e.g. if the 'subflows' limit was reached when sending
      the ADD_ADDR, but changed later on. It is probably not worth splitting
      id_avail_bitmap per target ('signal', 'subflow'), which will add another
      large field to the msk "just" to track (again) endpoints. Anyway,
      currently when the limits are changed, the kernel doesn't check if new
      subflows can be created or removed, because we would need to keep track
      of the received ADD_ADDR, and more. It sounds OK to assume that the
      limits should be properly configured before establishing new
      connections.
      
      Fixes: 86e39e04 ("mptcp: keep track of local endpoint still available for each msk")
      Cc: stable@vger.kernel.org
      Suggested-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Link: https://patch.msgid.link/20240731-upstream-net-20240731-mptcp-endp-subflow-signal-v1-5-c8a9b036493b@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      85df533a
    • Matthieu Baerts (NGI0)'s avatar
      mptcp: pm: don't try to create sf if alloc failed · cd7c957f
      Matthieu Baerts (NGI0) authored
      It sounds better to avoid wasting cycles and / or put extreme memory
      pressure on the system by trying to create new subflows if it was not
      possible to add a new item in the announce list.
      
      While at it, a warning is now printed if the entry was already in the
      list as it should not happen with the in-kernel path-manager. With this
      PM, mptcp_pm_alloc_anno_list() should only fail in case of memory
      pressure.
      
      Fixes: b6c08380 ("mptcp: remove addr and subflow in PM netlink")
      Cc: stable@vger.kernel.org
      Suggested-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Link: https://patch.msgid.link/20240731-upstream-net-20240731-mptcp-endp-subflow-signal-v1-4-c8a9b036493b@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      cd7c957f
    • Matthieu Baerts (NGI0)'s avatar
      c95eb32c
    • Matthieu Baerts (NGI0)'s avatar
      mptcp: pm: deny endp with signal + subflow + port · 8af1f118
      Matthieu Baerts (NGI0) authored
      As mentioned in the 'Fixes' commit, the port flag is only supported by
      the 'signal' flag, and not by the 'subflow' one. Then if both the
      'signal' and 'subflow' flags are set, the problem is the same: the
      feature cannot work with the 'subflow' flag.
      
      Technically, if both the 'signal' and 'subflow' flags are set, it will
      be possible to create the listening socket, but not to establish a
      subflow using this source port. So better to explicitly deny it, not to
      create some confusions because the expected behaviour is not possible.
      
      Fixes: 09f12c3a ("mptcp: allow to use port and non-signal in set_flags")
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Link: https://patch.msgid.link/20240731-upstream-net-20240731-mptcp-endp-subflow-signal-v1-2-c8a9b036493b@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      8af1f118
    • Matthieu Baerts (NGI0)'s avatar
      mptcp: fully established after ADD_ADDR echo on MPJ · d67c5649
      Matthieu Baerts (NGI0) authored
      Before this patch, receiving an ADD_ADDR echo on the just connected
      MP_JOIN subflow -- initiator side, after the MP_JOIN 3WHS -- was
      resulting in an MP_RESET. That's because only ACKs with a DSS or
      ADD_ADDRs without the echo bit were allowed.
      
      Not allowing the ADD_ADDR echo after an MP_CAPABLE 3WHS makes sense, as
      we are not supposed to send an ADD_ADDR before because it requires to be
      in full established mode first. For the MP_JOIN 3WHS, that's different:
      the ADD_ADDR can be sent on a previous subflow, and the ADD_ADDR echo
      can be received on the recently created one. The other peer will already
      be in fully established, so it is allowed to send that.
      
      We can then relax the conditions here to accept the ADD_ADDR echo for
      MPJ subflows.
      
      Fixes: 67b12f79 ("mptcp: full fully established support after ADD_ADDR")
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Link: https://patch.msgid.link/20240731-upstream-net-20240731-mptcp-endp-subflow-signal-v1-1-c8a9b036493b@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      d67c5649
  6. 01 Aug, 2024 20 commits