1. 05 3月, 2021 2 次提交
  2. 23 2月, 2021 1 次提交
  3. 13 2月, 2021 2 次提交
  4. 12 2月, 2021 2 次提交
  5. 03 2月, 2021 5 次提交
  6. 28 1月, 2021 1 次提交
  7. 23 1月, 2021 3 次提交
    • P
      mptcp: implement delegated actions · b19bc294
      Paolo Abeni 提交于
      On MPTCP-level ack reception, the packet scheduler
      may select a subflow other then the current one.
      
      Prior to this commit we rely on the workqueue to trigger
      action on such subflow.
      
      This changeset introduces an infrastructure that allows
      any MPTCP subflow to schedule actions (MPTCP xmit) on
      others subflows without resorting to (multiple) process
      reschedule.
      
      A dummy NAPI instance is used instead. When MPTCP needs to
      trigger action an a different subflow, it enqueues the target
      subflow on the NAPI backlog and schedule such instance as needed.
      
      The dummy NAPI poll method walks the sockets backlog and tries
      to acquire the (BH) socket lock on each of them. If the socket
      is owned by the user space, the action will be completed by
      the sock release cb, otherwise push is started.
      
      This change leverages the delegated action infrastructure
      to avoid invoking the MPTCP worker to spool the pending data,
      when the packet scheduler picks a subflow other then the one
      currently processing the incoming MPTCP-level ack.
      
      Additionally we further refine the subflow selection
      invoking the packet scheduler for each chunk of data
      even inside __mptcp_subflow_push_pending().
      
      v1 -> v2:
       - fix possible UaF at shutdown time, resetting sock ops
         after removing the ulp context
      Reviewed-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      b19bc294
    • P
      mptcp: re-enable sndbuf autotune · 5cf92bba
      Paolo Abeni 提交于
      After commit 6e628cd3 ("mptcp: use mptcp release_cb for
      delayed tasks"), MPTCP never sets the flag bit SOCK_NOSPACE
      on its subflow. As a side effect, autotune never takes place,
      as it happens inside tcp_new_space(), which in turn is called
      only when the mentioned bit is set.
      
      Let's sendmsg() set the subflows NOSPACE bit when looking for
      more memory and use the subflow write_space callback to propagate
      the snd buf update and wake-up the user-space.
      
      Additionally, this allows dropping a bunch of duplicate code and
      makes the SNDBUF_LIMITED chrono relevant again for MPTCP subflows.
      
      Fixes: 6e628cd3 ("mptcp: use mptcp release_cb for delayed tasks")
      Reviewed-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      5cf92bba
    • P
      mptcp: always graft subflow socket to parent · 866f26f2
      Paolo Abeni 提交于
      Currently, incoming subflows link to the parent socket,
      while outgoing ones link to a per subflow socket. The latter
      is not really needed, except at the initial connect() time and
      for the first subflow.
      
      Always graft the outgoing subflow to the parent socket and
      free the unneeded ones early.
      
      This allows some code cleanup, reduces the amount of memory
      used and will simplify the next patch
      Reviewed-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      866f26f2
  8. 15 12月, 2020 2 次提交
  9. 10 12月, 2020 2 次提交
    • P
      mptcp: plug subflow context memory leak · 0597d0f8
      Paolo Abeni 提交于
      When a MPTCP listener socket is closed with unaccepted
      children pending, the ULP release callback will be invoked,
      but nobody will call into __mptcp_close_ssk() on the
      corresponding subflow.
      
      As a consequence, at ULP release time, the 'disposable' flag
      will be cleared and the subflow context memory will be leaked.
      
      This change addresses the issue always freeing the context if
      the subflow is still in the accept queue at ULP release time.
      
      Additionally, this fixes an incorrect code reference in the
      related comment.
      
      Note: this fix leverages the changes introduced by the previous
      commit.
      
      Fixes: e16163b6 ("mptcp: refactor shutdown and close")
      Reviewed-by: NMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0597d0f8
    • P
      mptcp: link MPC subflow into msk only after accept · 5b950ff4
      Paolo Abeni 提交于
      Christoph reported the following splat:
      
      WARNING: CPU: 0 PID: 4615 at net/ipv4/inet_connection_sock.c:1031 inet_csk_listen_stop+0x8e8/0xad0 net/ipv4/inet_connection_sock.c:1031
      Modules linked in:
      CPU: 0 PID: 4615 Comm: syz-executor.4 Not tainted 5.9.0 #37
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
      RIP: 0010:inet_csk_listen_stop+0x8e8/0xad0 net/ipv4/inet_connection_sock.c:1031
      Code: 03 00 00 00 e8 79 b2 3d ff e9 ad f9 ff ff e8 1f 76 ba fe be 02 00 00 00 4c 89 f7 e8 62 b2 3d ff e9 14 f9 ff ff e8 08 76 ba fe <0f> 0b e9 97 f8 ff ff e8 fc 75 ba fe be 03 00 00 00 4c 89 f7 e8 3f
      RSP: 0018:ffffc900037f7948 EFLAGS: 00010293
      RAX: ffff88810a349c80 RBX: ffff888114ee1b00 RCX: ffffffff827b14cd
      RDX: 0000000000000000 RSI: ffffffff827b1c38 RDI: 0000000000000005
      RBP: ffff88810a2a8000 R08: ffff88810a349c80 R09: fffff520006fef1f
      R10: 0000000000000003 R11: fffff520006fef1e R12: ffff888114ee2d00
      R13: dffffc0000000000 R14: 0000000000000001 R15: ffff888114ee1d68
      FS:  00007f2ac1945700(0000) GS:ffff88811b400000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007ffd44798bc0 CR3: 0000000109810002 CR4: 0000000000170ef0
      Call Trace:
       __tcp_close+0xd86/0x1110 net/ipv4/tcp.c:2433
       __mptcp_close_ssk+0x256/0x430 net/mptcp/protocol.c:1761
       __mptcp_destroy_sock+0x49b/0x770 net/mptcp/protocol.c:2127
       mptcp_close+0x62d/0x910 net/mptcp/protocol.c:2184
       inet_release+0xe9/0x1f0 net/ipv4/af_inet.c:434
       __sock_release+0xd2/0x280 net/socket.c:596
       sock_close+0x15/0x20 net/socket.c:1277
       __fput+0x276/0x960 fs/file_table.c:281
       task_work_run+0x109/0x1d0 kernel/task_work.c:151
       get_signal+0xe8f/0x1d40 kernel/signal.c:2561
       arch_do_signal+0x88/0x1b60 arch/x86/kernel/signal.c:811
       exit_to_user_mode_loop kernel/entry/common.c:161 [inline]
       exit_to_user_mode_prepare+0x9b/0xf0 kernel/entry/common.c:191
       syscall_exit_to_user_mode+0x22/0x150 kernel/entry/common.c:266
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      RIP: 0033:0x7f2ac1254469
      Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 8b 0d ff 49 2b 00 f7 d8 64 89 01 48
      RSP: 002b:00007f2ac1944dc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
      RAX: ffffffffffffffbf RBX: 000000000069bf00 RCX: 00007f2ac1254469
      RDX: 0000000000000000 RSI: 0000000000008982 RDI: 0000000000000003
      RBP: 000000000069bf00 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 000000000069bf0c
      R13: 00007ffeb53f178f R14: 00000000004668b0 R15: 0000000000000003
      
      After commit 0397c6d8 ("mptcp: keep unaccepted MPC subflow into
      join list"), the msk's workqueue and/or PM can touch the MPC
      subflow - and acquire its socket lock - even if it's still unaccepted.
      
      If the above event races with the relevant listener socket close, we
      can end-up with the above splat.
      
      This change addresses the issue delaying the MPC socket insertion
      in conn_list at accept time - that is, partially reverting the
      blamed commit.
      
      We must additionally ensure that mptcp_pm_fully_established()
      happens after accept() time, or the PM will not be able to
      handle properly such event - conn_list could be empty otherwise.
      
      In the receive path, we check the subflow list node to ensure
      it is out of the listener queue. Be sure client subflows do
      not match transiently such condition moving them into the join
      list earlier at creation time.
      
      Since we now have multiple mptcp_pm_fully_established() call sites
      from different code-paths, said helper can now race with itself.
      Use an additional PM status bit to avoid multiple notifications.
      Reported-by: NChristoph Paasch <cpaasch@apple.com>
      Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/103
      Fixes: 0397c6d8 ("mptcp: keep unaccepted MPC subflow into join list"),
      Reviewed-by: NMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5b950ff4
  10. 04 12月, 2020 2 次提交
    • F
      mptcp: emit tcp reset when a join request fails · 3ecfbe3e
      Florian Westphal 提交于
      RFC 8684 says:
       If the token is unknown or the host wants to refuse subflow establishment
       (for example, due to a limit on the number of subflows it will permit),
       the receiver will send back a reset (RST) signal, analogous to an unknown
       port in TCP, containing an MP_TCPRST option (Section 3.6) with an
       "MPTCP specific error" reason code.
      
      mptcp-next doesn't support MP_TCPRST yet, this can be added in another
      change.
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Reviewed-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      3ecfbe3e
    • F
      tcp: merge 'init_req' and 'route_req' functions · 7ea851d1
      Florian Westphal 提交于
      The Multipath-TCP standard (RFC 8684) says that an MPTCP host should send
      a TCP reset if the token in a MP_JOIN request is unknown.
      
      At this time we don't do this, the 3whs completes and the 'new subflow'
      is reset afterwards.  There are two ways to allow MPTCP to send the
      reset.
      
      1. override 'send_synack' callback and emit the rst from there.
         The drawback is that the request socket gets inserted into the
         listeners queue just to get removed again right away.
      
      2. Send the reset from the 'route_req' function instead.
         This avoids the 'add&remove request socket', but route_req lacks the
         skb that is required to send the TCP reset.
      
      Instead of just adding the skb to that function for MPTCP sake alone,
      Paolo suggested to merge init_req and route_req functions.
      
      This saves one indirection from syn processing path and provides the skb
      to the merged function at the same time.
      
      'send reset on unknown mptcp join token' is added in next patch.
      Suggested-by: NPaolo Abeni <pabeni@redhat.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      7ea851d1
  11. 01 12月, 2020 1 次提交
  12. 28 11月, 2020 1 次提交
  13. 21 11月, 2020 2 次提交
  14. 20 11月, 2020 1 次提交
    • E
      crypto: sha - split sha.h into sha1.h and sha2.h · a24d22b2
      Eric Biggers 提交于
      Currently <crypto/sha.h> contains declarations for both SHA-1 and SHA-2,
      and <crypto/sha3.h> contains declarations for SHA-3.
      
      This organization is inconsistent, but more importantly SHA-1 is no
      longer considered to be cryptographically secure.  So to the extent
      possible, SHA-1 shouldn't be grouped together with any of the other SHA
      versions, and usage of it should be phased out.
      
      Therefore, split <crypto/sha.h> into two headers <crypto/sha1.h> and
      <crypto/sha2.h>, and make everyone explicitly specify whether they want
      the declarations for SHA-1, SHA-2, or both.
      
      This avoids making the SHA-1 declarations visible to files that don't
      want anything to do with SHA-1.  It also prepares for potentially moving
      sha1.h into a new insecure/ or dangerous/ directory.
      Signed-off-by: NEric Biggers <ebiggers@google.com>
      Acked-by: NArd Biesheuvel <ardb@kernel.org>
      Acked-by: NJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      a24d22b2
  15. 17 11月, 2020 2 次提交
    • F
      mptcp: rework poll+nospace handling · 8edf0864
      Florian Westphal 提交于
      MPTCP maintains a status bit, MPTCP_SEND_SPACE, that is set when at
      least one subflow and the mptcp socket itself are writeable.
      
      mptcp_poll returns EPOLLOUT if the bit is set.
      
      mptcp_sendmsg makes sure MPTCP_SEND_SPACE gets cleared when last write
      has used up all subflows or the mptcp socket wmem.
      
      This reworks nospace handling as follows:
      
      MPTCP_SEND_SPACE is replaced with MPTCP_NOSPACE, i.e. inverted meaning.
      This bit is set when the mptcp socket is not writeable.
      The mptcp-level ack path schedule will then schedule the mptcp worker
      to allow it to free already-acked data (and reduce wmem usage).
      
      This will then wake userspace processes that wait for a POLLOUT event.
      
      sendmsg will set MPTCP_NOSPACE only when it has to wait for more
      wmem (blocking I/O case).
      
      poll path will set MPTCP_NOSPACE in case the mptcp socket is
      not writeable.
      
      Normal tcp-level notification (SOCK_NOSPACE) is only enabled
      in case the subflow socket has no available wmem.
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      8edf0864
    • P
      mptcp: refactor shutdown and close · e16163b6
      Paolo Abeni 提交于
      We must not close the subflows before all the MPTCP level
      data, comprising the DATA_FIN has been acked at the MPTCP
      level, otherwise we could be unable to retransmit as needed.
      
      __mptcp_wr_shutdown() shutdown is responsible to check for the
      correct status and close all subflows. Is called by the output
      path after spooling any data and at shutdown/close time.
      
      In a similar way, __mptcp_destroy_sock() is responsible to clean-up
      the MPTCP level status, and is called when the msk transition
      to TCP_CLOSE.
      
      The protocol level close() does not force anymore the TCP_CLOSE
      status, but orphan the msk socket and all the subflows.
      Orphaned msk sockets are forciby closed after a timeout or
      when all MPTCP-level data is acked.
      
      There is a caveat about keeping the orphaned subflows around:
      the TCP stack can asynchronusly call tcp_cleanup_ulp() on them via
      tcp_close(). To prevent accessing freed memory on later MPTCP
      level operations, the msk acquires a reference to each subflow
      socket and prevent subflow_ulp_release() from releasing the
      subflow context before __mptcp_destroy_sock().
      
      The additional subflow references are released by __mptcp_done()
      and the async ULP release is detected checking ULP ops. If such
      field has been already cleared by the ULP release path, the
      dangling context is freed directly by __mptcp_done().
      Co-developed-by: NDavide Caratti <dcaratti@redhat.com>
      Signed-off-by: NDavide Caratti <dcaratti@redhat.com>
      Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      e16163b6
  16. 11 10月, 2020 2 次提交
  17. 09 10月, 2020 1 次提交
  18. 06 10月, 2020 1 次提交
  19. 30 9月, 2020 1 次提交
  20. 25 9月, 2020 2 次提交
  21. 24 9月, 2020 1 次提交
  22. 18 9月, 2020 1 次提交
  23. 15 9月, 2020 2 次提交