1. 25 9月, 2021 2 次提交
  2. 23 9月, 2021 2 次提交
    • P
      mptcp: stop relying on tcp_tx_skb_cache · f70cad10
      Paolo Abeni 提交于
      We want to revert the skb TX cache, but MPTCP is currently
      using it unconditionally.
      
      Rework the MPTCP tx code, so that tcp_tx_skb_cache is not
      needed anymore: do the whole coalescing check, skb allocation
      skb initialization/update inside mptcp_sendmsg_frag(), quite
      alike the current TCP code.
      Reviewed-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f70cad10
    • P
      mptcp: ensure tx skbs always have the MPTCP ext · efe686ff
      Paolo Abeni 提交于
      Due to signed/unsigned comparison, the expression:
      
      	info->size_goal - skb->len > 0
      
      evaluates to true when the size goal is smaller than the
      skb size. That results in lack of tx cache refill, so that
      the skb allocated by the core TCP code lacks the required
      MPTCP skb extensions.
      
      Due to the above, syzbot is able to trigger the following WARN_ON():
      
      WARNING: CPU: 1 PID: 810 at net/mptcp/protocol.c:1366 mptcp_sendmsg_frag+0x1362/0x1bc0 net/mptcp/protocol.c:1366
      Modules linked in:
      CPU: 1 PID: 810 Comm: syz-executor.4 Not tainted 5.14.0-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      RIP: 0010:mptcp_sendmsg_frag+0x1362/0x1bc0 net/mptcp/protocol.c:1366
      Code: ff 4c 8b 74 24 50 48 8b 5c 24 58 e9 0f fb ff ff e8 13 44 8b f8 4c 89 e7 45 31 ed e8 98 57 2e fe e9 81 f4 ff ff e8 fe 43 8b f8 <0f> 0b 41 bd ea ff ff ff e9 6f f4 ff ff 4c 89 e7 e8 b9 8e d2 f8 e9
      RSP: 0018:ffffc9000531f6a0 EFLAGS: 00010216
      RAX: 000000000000697f RBX: 0000000000000000 RCX: ffffc90012107000
      RDX: 0000000000040000 RSI: ffffffff88eac9e2 RDI: 0000000000000003
      RBP: ffff888078b15780 R08: 0000000000000000 R09: 0000000000000000
      R10: ffffffff88eac017 R11: 0000000000000000 R12: ffff88801de0a280
      R13: 0000000000006b58 R14: ffff888066278280 R15: ffff88803c2fe9c0
      FS:  00007fd9f866e700(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007faebcb2f718 CR3: 00000000267cb000 CR4: 00000000001506e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       __mptcp_push_pending+0x1fb/0x6b0 net/mptcp/protocol.c:1547
       mptcp_release_cb+0xfe/0x210 net/mptcp/protocol.c:3003
       release_sock+0xb4/0x1b0 net/core/sock.c:3206
       sk_stream_wait_memory+0x604/0xed0 net/core/stream.c:145
       mptcp_sendmsg+0xc39/0x1bc0 net/mptcp/protocol.c:1749
       inet6_sendmsg+0x99/0xe0 net/ipv6/af_inet6.c:643
       sock_sendmsg_nosec net/socket.c:704 [inline]
       sock_sendmsg+0xcf/0x120 net/socket.c:724
       sock_write_iter+0x2a0/0x3e0 net/socket.c:1057
       call_write_iter include/linux/fs.h:2163 [inline]
       new_sync_write+0x40b/0x640 fs/read_write.c:507
       vfs_write+0x7cf/0xae0 fs/read_write.c:594
       ksys_write+0x1ee/0x250 fs/read_write.c:647
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      RIP: 0033:0x4665f9
      Code: ff ff 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 c7 c1 bc ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007fd9f866e188 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
      RAX: ffffffffffffffda RBX: 000000000056c038 RCX: 00000000004665f9
      RDX: 00000000000e7b78 RSI: 0000000020000000 RDI: 0000000000000003
      RBP: 00000000004bfcc4 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056c038
      R13: 0000000000a9fb1f R14: 00007fd9f866e300 R15: 0000000000022000
      
      Fix the issue rewriting the relevant expression to avoid
      sign-related problems - note: size_goal is always >= 0.
      
      Additionally, ensure that the skb in the tx cache always carries
      the relevant extension.
      
      Reported-and-tested-by: syzbot+263a248eec3e875baa7b@syzkaller.appspotmail.com
      Fixes: 1094c6fe ("mptcp: fix possible divide by zero")
      Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      efe686ff
  3. 22 9月, 2021 1 次提交
    • P
      mptcp: ensure tx skbs always have the MPTCP ext · 977d293e
      Paolo Abeni 提交于
      Due to signed/unsigned comparison, the expression:
      
      	info->size_goal - skb->len > 0
      
      evaluates to true when the size goal is smaller than the
      skb size. That results in lack of tx cache refill, so that
      the skb allocated by the core TCP code lacks the required
      MPTCP skb extensions.
      
      Due to the above, syzbot is able to trigger the following WARN_ON():
      
      WARNING: CPU: 1 PID: 810 at net/mptcp/protocol.c:1366 mptcp_sendmsg_frag+0x1362/0x1bc0 net/mptcp/protocol.c:1366
      Modules linked in:
      CPU: 1 PID: 810 Comm: syz-executor.4 Not tainted 5.14.0-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      RIP: 0010:mptcp_sendmsg_frag+0x1362/0x1bc0 net/mptcp/protocol.c:1366
      Code: ff 4c 8b 74 24 50 48 8b 5c 24 58 e9 0f fb ff ff e8 13 44 8b f8 4c 89 e7 45 31 ed e8 98 57 2e fe e9 81 f4 ff ff e8 fe 43 8b f8 <0f> 0b 41 bd ea ff ff ff e9 6f f4 ff ff 4c 89 e7 e8 b9 8e d2 f8 e9
      RSP: 0018:ffffc9000531f6a0 EFLAGS: 00010216
      RAX: 000000000000697f RBX: 0000000000000000 RCX: ffffc90012107000
      RDX: 0000000000040000 RSI: ffffffff88eac9e2 RDI: 0000000000000003
      RBP: ffff888078b15780 R08: 0000000000000000 R09: 0000000000000000
      R10: ffffffff88eac017 R11: 0000000000000000 R12: ffff88801de0a280
      R13: 0000000000006b58 R14: ffff888066278280 R15: ffff88803c2fe9c0
      FS:  00007fd9f866e700(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007faebcb2f718 CR3: 00000000267cb000 CR4: 00000000001506e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       __mptcp_push_pending+0x1fb/0x6b0 net/mptcp/protocol.c:1547
       mptcp_release_cb+0xfe/0x210 net/mptcp/protocol.c:3003
       release_sock+0xb4/0x1b0 net/core/sock.c:3206
       sk_stream_wait_memory+0x604/0xed0 net/core/stream.c:145
       mptcp_sendmsg+0xc39/0x1bc0 net/mptcp/protocol.c:1749
       inet6_sendmsg+0x99/0xe0 net/ipv6/af_inet6.c:643
       sock_sendmsg_nosec net/socket.c:704 [inline]
       sock_sendmsg+0xcf/0x120 net/socket.c:724
       sock_write_iter+0x2a0/0x3e0 net/socket.c:1057
       call_write_iter include/linux/fs.h:2163 [inline]
       new_sync_write+0x40b/0x640 fs/read_write.c:507
       vfs_write+0x7cf/0xae0 fs/read_write.c:594
       ksys_write+0x1ee/0x250 fs/read_write.c:647
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      RIP: 0033:0x4665f9
      Code: ff ff 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 c7 c1 bc ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007fd9f866e188 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
      RAX: ffffffffffffffda RBX: 000000000056c038 RCX: 00000000004665f9
      RDX: 00000000000e7b78 RSI: 0000000020000000 RDI: 0000000000000003
      RBP: 00000000004bfcc4 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056c038
      R13: 0000000000a9fb1f R14: 00007fd9f866e300 R15: 0000000000022000
      
      Fix the issue rewriting the relevant expression to avoid
      sign-related problems - note: size_goal is always >= 0.
      
      Additionally, ensure that the skb in the tx cache always carries
      the relevant extension.
      
      Reported-and-tested-by: syzbot+263a248eec3e875baa7b@syzkaller.appspotmail.com
      Fixes: 1094c6fe ("mptcp: fix possible divide by zero")
      Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      977d293e
  4. 18 9月, 2021 4 次提交
    • F
      mptcp: add MPTCP_SUBFLOW_ADDRS getsockopt support · c11c5906
      Florian Westphal 提交于
      This retrieves the address pairs of all subflows currently
      active for a given mptcp connection.
      
      It re-uses the same meta-header as for MPTCP_TCPINFO.
      
      A new structure is provided to hold the subflow
      address data:
      
      struct mptcp_subflow_addrs {
      	union {
      		__kernel_sa_family_t sa_family;
      		struct sockaddr sa_local;
      		struct sockaddr_in sin_local;
      		struct sockaddr_in6 sin6_local;
      		struct sockaddr_storage ss_local;
      	};
      	union {
      		struct sockaddr sa_remote;
      		struct sockaddr_in sin_remote;
      		struct sockaddr_in6 sin6_remote;
      		struct sockaddr_storage ss_remote;
      	};
      };
      
      Usage of the new getsockopt is very similar to
      MPTCP_TCPINFO one.
      
      Userspace allocates a
      'struct mptcp_subflow_data', followed by one or
      more 'struct mptcp_subflow_addrs', then inits the
      mptcp_subflow_data structure as follows:
      
      struct mptcp_subflow_addrs *sf_addr;
      struct mptcp_subflow_data *addr;
      socklen_t olen = sizeof(*addr) + (8 * sizeof(*sf_addr));
      
      addr = malloc(olen);
      addr->size_subflow_data = sizeof(*addr);
      addr->num_subflows = 0;
      addr->size_kernel = 0;
      addr->size_user = sizeof(struct mptcp_subflow_addrs);
      
      sf_addr = (struct mptcp_subflow_addrs *)(addr + 1);
      
      and then retrieves the endpoint addresses via:
      ret = getsockopt(fd, SOL_MPTCP, MPTCP_SUBFLOW_ADDRS,
      		 addr, &olen);
      
      If the call succeeds, kernel will have added up to 8
      endpoint addresses after the 'mptcp_subflow_data' header.
      
      Userspace needs to re-check 'olen' value to detect how
      many bytes have been filled in by the kernel.
      
      Userspace can check addr->num_subflows to discover when
      there were more subflows that available data space.
      Co-developed-by: NMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: NMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c11c5906
    • F
      mptcp: add MPTCP_TCPINFO getsockopt support · 06f15cee
      Florian Westphal 提交于
      Allow users to retrieve TCP_INFO data of all subflows.
      
      Users need to pre-initialize a meta header that has to be
      prepended to the data buffer that will be filled with the tcp info data.
      
      The meta header looks like this:
      
      struct mptcp_subflow_data {
       __u32 size_subflow_data;/* size of this structure in userspace */
       __u32 num_subflows;	/* must be 0, set by kernel */
       __u32 size_kernel;	/* must be 0, set by kernel */
       __u32 size_user;	/* size of one element in data[] */
      } __attribute__((aligned(8)));
      
      size_subflow_data has to be set to 'sizeof(struct mptcp_subflow_data)'.
      This allows to extend mptcp_subflow_data structure later on without
      breaking backwards compatibility.
      
      If the structure is extended later on, kernel knows where the
      userspace-provided meta header ends, even if userspace uses an older
      (smaller) version of the structure.
      
      num_subflows must be set to 0. If the getsockopt request succeeds (return
      value is 0), it will be updated to contain the number of active subflows
      for the given logical connection.
      
      size_kernel must be set to 0. If the getsockopt request is successful,
      it will contain the size of the 'struct tcp_info' as known by the kernel.
      This is informational only.
      
      size_user must be set to 'sizeof(struct tcp_info)'.
      
      This allows the kernel to only fill in the space reserved/expected by
      userspace.
      
      Example:
      
      struct my_tcp_info {
        struct mptcp_subflow_data d;
        struct tcp_info ti[2];
      };
      struct my_tcp_info ti;
      socklen_t olen;
      
      memset(&ti, 0, sizeof(ti));
      
      ti.d.size_subflow_data = sizeof(struct mptcp_subflow_data);
      ti.d.size_user = sizeof(struct tcp_info);
      olen = sizeof(ti);
      
      ret = getsockopt(fd, SOL_MPTCP, MPTCP_TCPINFO, &ti, &olen);
      if (ret < 0)
      	die_perror("getsockopt MPTCP_TCPINFO");
      
      mptcp_subflow_data.num_subflows is populated with the number of
      subflows that exist on the kernel side for the logical mptcp connection.
      
      This allows userspace to re-try with a larger tcp_info array if the number
      of subflows was larger than the available space in the ti[] array.
      
      olen has to be set to the number of bytes that userspace has allocated to
      receive the kernel data.  It will be updated to contain the real number
      bytes that have been copied to by the kernel.
      
      In the above example, if the number if subflows was 1, olen is equal to
      'sizeof(struct mptcp_subflow_data) + sizeof(struct tcp_info).
      For 2 or more subflows olen is equal to 'sizeof(struct my_tcp_info)'.
      
      If there was more data that could not be copied due to lack of space
      in the option buffer, userspace can detect this by checking
      mptcp_subflow_data->num_subflows.
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      06f15cee
    • F
      mptcp: add MPTCP_INFO getsockopt · 55c42fa7
      Florian Westphal 提交于
      Its not compatible with multipath-tcp.org kernel one.
      
      1. The out-of-tree implementation defines a different 'struct mptcp_info',
         with embedded __user addresses for additional data such as
         endpoint addresses.
      
      2. Mat Martineau points out that embedded __user addresses doesn't work
      with BPF_CGROUP_RUN_PROG_GETSOCKOPT() which assumes that copying in
      optsize bytes from optval provides all data that got copied to userspace.
      
      This provides mptcp_info data for the given mptcp socket.
      
      Userspace sets optlen to the size of the structure it expects.
      The kernel updates it to contain the number of bytes that it copied.
      
      This allows to append more information to the structure later.
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      55c42fa7
    • F
      mptcp: add new mptcp_fill_diag helper · 61bc6e82
      Florian Westphal 提交于
      Will be re-used from getsockopt path.
      Since diag can be a module, we can't export the helper from diag, it
      needs to be moved to core.
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      61bc6e82
  5. 03 9月, 2021 1 次提交
    • M
      mptcp: Only send extra TCP acks in eligible socket states · 340fa666
      Mat Martineau 提交于
      Recent changes exposed a bug where specifically-timed requests to the
      path manager netlink API could trigger a divide-by-zero in
      __tcp_select_window(), as syzkaller does:
      
      divide error: 0000 [#1] SMP KASAN NOPTI
      CPU: 0 PID: 9667 Comm: syz-executor.0 Not tainted 5.14.0-rc6+ #3
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014
      RIP: 0010:__tcp_select_window+0x509/0xa60 net/ipv4/tcp_output.c:3016
      Code: 44 89 ff e8 c9 29 e9 fd 45 39 e7 0f 8d 20 ff ff ff e8 db 28 e9 fd 44 89 e3 e9 13 ff ff ff e8 ce 28 e9 fd 44 89 e0 44 89 e3 99 <f7> 7c 24 04 29 d3 e9 fc fe ff ff e8 b7 28 e9 fd 44 89 f1 48 89 ea
      RSP: 0018:ffff888031ccf020 EFLAGS: 00010216
      RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000040000
      RDX: 0000000000000000 RSI: ffff88811532c080 RDI: 0000000000000002
      RBP: 0000000000000000 R08: ffffffff835807c2 R09: 0000000000000000
      R10: 0000000000000004 R11: ffffed1020b92441 R12: 0000000000000000
      R13: 1ffff11006399e08 R14: 0000000000000000 R15: 0000000000000000
      FS:  00007fa4c8344700(0000) GS:ffff88811ae00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000001b2f424000 CR3: 000000003e4e2003 CR4: 0000000000770ef0
      PKRU: 55555554
      Call Trace:
       tcp_select_window net/ipv4/tcp_output.c:264 [inline]
       __tcp_transmit_skb+0xc00/0x37a0 net/ipv4/tcp_output.c:1351
       __tcp_send_ack.part.0+0x3ec/0x760 net/ipv4/tcp_output.c:3972
       __tcp_send_ack net/ipv4/tcp_output.c:3978 [inline]
       tcp_send_ack+0x7d/0xa0 net/ipv4/tcp_output.c:3978
       mptcp_pm_nl_addr_send_ack+0x1ab/0x380 net/mptcp/pm_netlink.c:654
       mptcp_pm_remove_addr+0x161/0x200 net/mptcp/pm.c:58
       mptcp_nl_remove_id_zero_address+0x197/0x460 net/mptcp/pm_netlink.c:1328
       mptcp_nl_cmd_del_addr+0x98b/0xd40 net/mptcp/pm_netlink.c:1359
       genl_family_rcv_msg_doit.isra.0+0x225/0x340 net/netlink/genetlink.c:731
       genl_family_rcv_msg net/netlink/genetlink.c:775 [inline]
       genl_rcv_msg+0x341/0x5b0 net/netlink/genetlink.c:792
       netlink_rcv_skb+0x148/0x430 net/netlink/af_netlink.c:2504
       genl_rcv+0x24/0x40 net/netlink/genetlink.c:803
       netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline]
       netlink_unicast+0x537/0x750 net/netlink/af_netlink.c:1340
       netlink_sendmsg+0x846/0xd80 net/netlink/af_netlink.c:1929
       sock_sendmsg_nosec net/socket.c:704 [inline]
       sock_sendmsg+0x14e/0x190 net/socket.c:724
       ____sys_sendmsg+0x709/0x870 net/socket.c:2403
       ___sys_sendmsg+0xff/0x170 net/socket.c:2457
       __sys_sendmsg+0xe5/0x1b0 net/socket.c:2486
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x38/0x90 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      mptcp_pm_nl_addr_send_ack() was attempting to send a TCP ACK on the
      first subflow in the MPTCP socket's connection list without validating
      that the subflow was in a suitable connection state. To address this,
      always validate subflow state when sending extra ACKs on subflows
      for address advertisement or subflow priority change.
      
      Fixes: 84dfe367 ("mptcp: send out dedicated ADD_ADDR packet")
      Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/229Co-developed-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Acked-by: NGeliang Tang <geliangtang@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      340fa666
  6. 02 9月, 2021 1 次提交
    • P
      mptcp: fix possible divide by zero · 1094c6fe
      Paolo Abeni 提交于
      Florian noted that if mptcp_alloc_tx_skb() allocation fails
      in __mptcp_push_pending(), we can end-up invoking
      mptcp_push_release()/tcp_push() with a zero mss, causing
      a divide by 0 error.
      
      This change addresses the issue refactoring the skb allocation
      code checking if skb collapsing will happen for sure and doing
      the skb allocation only after such check. Skb allocation will
      now happen only after the call to tcp_send_mss() which
      correctly initializes mss_now.
      
      As side bonuses we now fill the skb tx cache only when needed,
      and this also clean-up a bit the output path.
      
      v1 -> v2:
       - use lockdep_assert_held_once() - Jakub
       - fix indentation - Jakub
      Reported-by: NFlorian Westphal <fw@strlen.de>
      Fixes: 724cfd2e ("mptcp: allocate TX skbs in msk context")
      Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      1094c6fe
  7. 01 9月, 2021 1 次提交
  8. 27 8月, 2021 5 次提交
  9. 25 8月, 2021 5 次提交
  10. 24 8月, 2021 5 次提交
  11. 19 8月, 2021 2 次提交
    • M
      mptcp: full fully established support after ADD_ADDR · 67b12f79
      Matthieu Baerts 提交于
      If directly after an MP_CAPABLE 3WHS, the client receives an ADD_ADDR
      with HMAC from the server, it is enough to switch to a "fully
      established" mode because it has received more MPTCP options.
      
      It was then OK to enable the "fully_established" flag on the MPTCP
      socket. Still, best to check if the ADD_ADDR looks valid by looking if
      it contains an HMAC (no 'echo' bit). If an ADD_ADDR echo is received
      while we are not in "fully established" mode, it is strange and then
      we should not switch to this mode now.
      
      But that is not enough. On one hand, the path-manager has be notified
      the state has changed. On the other hand, the "fully_established" flag
      on the subflow socket should be turned on as well not to re-send the
      MP_CAPABLE 3rd ACK content with the next ACK.
      
      Fixes: 84dfe367 ("mptcp: send out dedicated ADD_ADDR packet")
      Signed-off-by: NMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      67b12f79
    • P
      mptcp: fix memory leak on address flush · a0eea5f1
      Paolo Abeni 提交于
      The endpoint cleanup path is prone to a memory leak, as reported
      by syzkaller:
      
       BUG: memory leak
       unreferenced object 0xffff88810680ea00 (size 64):
         comm "syz-executor.6", pid 6191, jiffies 4295756280 (age 24.138s)
         hex dump (first 32 bytes):
           58 75 7d 3c 80 88 ff ff 22 01 00 00 00 00 ad de  Xu}<....".......
           01 00 02 00 00 00 00 00 ac 1e 00 07 00 00 00 00  ................
         backtrace:
           [<0000000072a9f72a>] kmalloc include/linux/slab.h:591 [inline]
           [<0000000072a9f72a>] mptcp_nl_cmd_add_addr+0x287/0x9f0 net/mptcp/pm_netlink.c:1170
           [<00000000f6e931bf>] genl_family_rcv_msg_doit.isra.0+0x225/0x340 net/netlink/genetlink.c:731
           [<00000000f1504a2c>] genl_family_rcv_msg net/netlink/genetlink.c:775 [inline]
           [<00000000f1504a2c>] genl_rcv_msg+0x341/0x5b0 net/netlink/genetlink.c:792
           [<0000000097e76f6a>] netlink_rcv_skb+0x148/0x430 net/netlink/af_netlink.c:2504
           [<00000000ceefa2b8>] genl_rcv+0x24/0x40 net/netlink/genetlink.c:803
           [<000000008ff91aec>] netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline]
           [<000000008ff91aec>] netlink_unicast+0x537/0x750 net/netlink/af_netlink.c:1340
           [<0000000041682c35>] netlink_sendmsg+0x846/0xd80 net/netlink/af_netlink.c:1929
           [<00000000df3aa8e7>] sock_sendmsg_nosec net/socket.c:704 [inline]
           [<00000000df3aa8e7>] sock_sendmsg+0x14e/0x190 net/socket.c:724
           [<000000002154c54c>] ____sys_sendmsg+0x709/0x870 net/socket.c:2403
           [<000000001aab01d7>] ___sys_sendmsg+0xff/0x170 net/socket.c:2457
           [<00000000fa3b1446>] __sys_sendmsg+0xe5/0x1b0 net/socket.c:2486
           [<00000000db2ee9c7>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
           [<00000000db2ee9c7>] do_syscall_64+0x38/0x90 arch/x86/entry/common.c:80
           [<000000005873517d>] entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      We should not require an allocation to cleanup stuff.
      
      Rework the code a bit so that the additional RCU work is no more needed.
      
      Fixes: 1729cf18 ("mptcp: create the listening socket for new port")
      Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a0eea5f1
  12. 18 8月, 2021 3 次提交
  13. 14 8月, 2021 7 次提交
  14. 04 8月, 2021 1 次提交