1. 19 6月, 2021 1 次提交
  2. 26 5月, 2021 2 次提交
    • D
      mptcp: validate 'id' when stopping the ADD_ADDR retransmit timer · d58300c3
      Davide Caratti 提交于
      when Linux receives an echo-ed ADD_ADDR, it checks the IP address against
      the list of "announced" addresses. In case of a positive match, the timer
      that handles retransmissions is stopped regardless of the 'Address Id' in
      the received packet: this behaviour does not comply with RFC8684 3.4.1.
      
      Fix it by validating the 'Address Id' in received echo-ed ADD_ADDRs.
      Tested using packetdrill, with the following captured output:
      
       unpatched kernel:
      
       Out <...> Flags [.], ack 1, win 256, options [mptcp add-addr v1 id 1 198.51.100.2 hmac 0xfd2e62517888fe29,mptcp dss ack 3007449509], length 0
       In  <...> Flags [.], ack 1, win 257, options [mptcp add-addr v1-echo id 1 1.2.3.4,mptcp dss ack 3013740213], length 0
       Out <...> Flags [.], ack 1, win 256, options [mptcp add-addr v1 id 1 198.51.100.2 hmac 0xfd2e62517888fe29,mptcp dss ack 3007449509], length 0
       In  <...> Flags [.], ack 1, win 257, options [mptcp add-addr v1-echo id 90 198.51.100.2,mptcp dss ack 3013740213], length 0
              ^^^ retransmission is stopped here, but 'Address Id' is 90
      
       patched kernel:
      
       Out <...> Flags [.], ack 1, win 256, options [mptcp add-addr v1 id 1 198.51.100.2 hmac 0x1cf372d59e05f4b8,mptcp dss ack 3007449509], length 0
       In  <...> Flags [.], ack 1, win 257, options [mptcp add-addr v1-echo id 1 1.2.3.4,mptcp dss ack 1672384568], length 0
       Out <...> Flags [.], ack 1, win 256, options [mptcp add-addr v1 id 1 198.51.100.2 hmac 0x1cf372d59e05f4b8,mptcp dss ack 3007449509], length 0
       In  <...> Flags [.], ack 1, win 257, options [mptcp add-addr v1-echo id 90 198.51.100.2,mptcp dss ack 1672384568], length 0
       Out <...> Flags [.], ack 1, win 256, options [mptcp add-addr v1 id 1 198.51.100.2 hmac 0x1cf372d59e05f4b8,mptcp dss ack 3007449509], length 0
       In  <...> Flags [.], ack 1, win 257, options [mptcp add-addr v1-echo id 1 198.51.100.2,mptcp dss ack 1672384568], length 0
              ^^^ retransmission is stopped here, only when both 'Address Id' and 'IP Address' match
      
      Fixes: 00cfd77b ("mptcp: retransmit ADD_ADDR when timeout")
      Signed-off-by: NDavide Caratti <dcaratti@redhat.com>
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d58300c3
    • P
      mptcp: drop unconditional pr_warn on bad opt · 3812ce89
      Paolo Abeni 提交于
      This is a left-over of early day. A malicious peer can flood
      the kernel logs with useless messages, just drop it.
      
      Fixes: f296234c ("mptcp: Add handling of incoming MP_JOIN requests")
      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>
      3812ce89
  3. 17 4月, 2021 1 次提交
  4. 08 4月, 2021 6 次提交
  5. 03 4月, 2021 2 次提交
  6. 27 3月, 2021 2 次提交
  7. 16 3月, 2021 1 次提交
  8. 13 3月, 2021 2 次提交
    • G
      mptcp: add rm_list in mptcp_options_received · 5c4a824d
      Geliang Tang 提交于
      This patch changed the member rm_id in struct mptcp_options_received as a
      list of the removing address ids, and renamed it to rm_list.
      
      In mptcp_parse_option, parsed the RM_ADDR suboption and filled them into
      the rm_list in struct mptcp_options_received.
      
      In mptcp_incoming_options, passed this rm_list to the function
      mptcp_pm_rm_addr_received.
      
      It also changed the parameter type of mptcp_pm_rm_addr_received.
      Signed-off-by: NGeliang Tang <geliangtang@gmail.com>
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5c4a824d
    • G
      mptcp: add rm_list in mptcp_out_options · 6445e17a
      Geliang Tang 提交于
      This patch defined a new struct mptcp_rm_list, the ids field was an
      array of the removing address ids, the nr field was the valid number of
      removing address ids in the array. The array size was definced as a new
      macro MPTCP_RM_IDS_MAX. Changed the member rm_id of struct
      mptcp_out_options to rm_list.
      
      In mptcp_established_options_rm_addr, invoked mptcp_pm_rm_addr_signal to
      get the rm_list. According the number of addresses in it, calculated
      the padded RM_ADDR suboption length. And saved the ids array in struct
      mptcp_out_options's rm_list member.
      
      In mptcp_write_options, iterated each address id from struct
      mptcp_out_options's rm_list member, set the invalid ones as TCPOPT_NOP,
      then filled them into the RM_ADDR suboption.
      
      Changed TCPOLEN_MPTCP_RM_ADDR_BASE from 4 to 3.
      Signed-off-by: NGeliang Tang <geliangtang@gmail.com>
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6445e17a
  9. 23 2月, 2021 1 次提交
    • P
      mptcp: fix DATA_FIN generation on early shutdown · d87903b6
      Paolo Abeni 提交于
      If the msk is closed before sending or receiving any data,
      no DATA_FIN is generated, instead an MPC ack packet is
      crafted out.
      
      In the above scenario, the MPTCP protocol creates and sends a
      pure ack and such packets matches also the criteria for an
      MPC ack and the protocol tries first to insert MPC options,
      leading to the described error.
      
      This change addresses the issue by avoiding the insertion of an
      MPC option for DATA_FIN packets or if the sub-flow is not
      established.
      
      To avoid doing multiple times the same test, fetch the data_fin
      flag in a bool variable and pass it to both the interested
      helpers.
      
      Fixes: 6d0060f6 ("mptcp: Write MPTCP DSS headers to outgoing data packets")
      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>
      d87903b6
  10. 13 2月, 2021 1 次提交
  11. 12 2月, 2021 2 次提交
  12. 03 2月, 2021 2 次提交
    • G
      mptcp: add the mibs for ADD_ADDR with port · 2fbdd9ea
      Geliang Tang 提交于
      This patch adds the mibs for ADD_ADDR with port:
      
      MPTCP_MIB_PORTADD for received ADD_ADDR suboption with a port number.
      
      MPTCP_MIB_PORTSYNRX, MPTCP_MIB_PORTSYNACKRX, MPTCP_MIB_PORTACKRX, for
      received MP_JOIN's SYN or SYN/ACK or ACK with a port number which is
      different from the msk's port number.
      
      MPTCP_MIB_MISMATCHPORTSYNRX and MPTCP_MIB_MISMATCHPORTACKRX, for
      received SYN or ACK MP_JOIN with a mismatched port-number.
      Signed-off-by: NGeliang Tang <geliangtang@gmail.com>
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      2fbdd9ea
    • D
      mptcp: fix length of MP_PRIO suboption · ec99a470
      Davide Caratti 提交于
      With version 0 of the protocol it was legal to encode the 'Subflow Id' in
      the MP_PRIO suboption, to specify which subflow would change its 'Backup'
      flag. This has been removed from v1 specification: thus, according to RFC
      8684 §3.3.8, the resulting 'Length' for MP_PRIO changed from 4 to 3 byte.
      
      Current Linux generates / parses MP_PRIO according to the old spec, using
      'Length' equal to 4, and hardcoding 1 as 'Subflow Id'; RFC compliance can
      improve if we change 'Length' in other to become 3, leaving a 'Nop' after
      the MP_PRIO suboption. In this way the kernel will emit and accept *only*
      MP_PRIO suboptions that are compliant to version 1 of the MPTCP protocol.
      
       unpatched 5.11-rc kernel:
       [root@bottarga ~]# tcpdump -tnnr unpatched.pcap | grep prio
       reading from file unpatched.pcap, link-type LINUX_SLL (Linux cooked v1)
       dropped privs to tcpdump
       IP 10.0.3.2.48433 > 10.0.1.1.10006: Flags [.], ack 1, win 502, options [nop,nop,TS val 4032325513 ecr 1876514270,mptcp prio non-backup id 1,mptcp dss ack 14084896651682217737], length 0
      
       patched 5.11-rc kernel:
       [root@bottarga ~]# tcpdump -tnnr patched.pcap | grep prio
       reading from file patched.pcap, link-type LINUX_SLL (Linux cooked v1)
       dropped privs to tcpdump
       IP 10.0.3.2.49735 > 10.0.1.1.10006: Flags [.], ack 1, win 502, options [nop,nop,TS val 1276737699 ecr 2686399734,mptcp prio non-backup,nop,mptcp dss ack 18433038869082491686], length 0
      
      Changes since v2:
       - when accounting for option space, don't increment 'TCPOLEN_MPTCP_PRIO'
         and use 'TCPOLEN_MPTCP_PRIO_ALIGN' instead, thanks to Matthieu Baerts.
      Changes since v1:
       - refactor patch to avoid using 'TCPOLEN_MPTCP_PRIO' with its old value,
         thanks to Geliang Tang.
      
      Fixes: 06706542 ("mptcp: add the outgoing MP_PRIO support")
      Reviewed-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Reviewed-by: NMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: NDavide Caratti <dcaratti@redhat.com>
      Reviewed-by: NMatteo Croce <mcroce@linux.microsoft.com>
      Link: https://lore.kernel.org/r/846cdd41e6ad6ec88ef23fee1552ab39c2f5a3d1.1612184361.git.dcaratti@redhat.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      ec99a470
  13. 10 1月, 2021 3 次提交
  14. 18 12月, 2020 1 次提交
  15. 17 12月, 2020 1 次提交
    • G
      mptcp: clear use_ack and use_map when dropping other suboptions · 3ae32c07
      Geliang Tang 提交于
      This patch cleared use_ack and use_map when dropping other suboptions to
      fix the following syzkaller BUG:
      
      [   15.223006] BUG: unable to handle page fault for address: 0000000000223b10
      [   15.223700] #PF: supervisor read access in kernel mode
      [   15.224209] #PF: error_code(0x0000) - not-present page
      [   15.224724] PGD b8d5067 P4D b8d5067 PUD c0a5067 PMD 0
      [   15.225237] Oops: 0000 [#1] SMP
      [   15.225556] CPU: 0 PID: 7747 Comm: syz-executor Not tainted 5.10.0-rc6+ #24
      [   15.226281] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
      [   15.227292] RIP: 0010:skb_release_data+0x89/0x1e0
      [   15.227816] Code: 5b 5d 41 5c 41 5d 41 5e 41 5f e9 02 06 8a ff e8 fd 05 8a ff 45 31 ed 80 7d 02 00 4c 8d 65 30 74 55 e8 eb 05 8a ff 49 8b 1c 24 <4c> 8b 7b 08 41 f6 c7 01 0f 85 18 01 00 00 e8 d4 05 8a ff 8b 43 34
      [   15.229669] RSP: 0018:ffffc900019c7c08 EFLAGS: 00010293
      [   15.230188] RAX: ffff88800daad900 RBX: 0000000000223b08 RCX: 0000000000000006
      [   15.230895] RDX: 0000000000000000 RSI: ffffffff818e06c5 RDI: ffff88807f6dc700
      [   15.231593] RBP: ffff88807f71a4c0 R08: 0000000000000001 R09: 0000000000000001
      [   15.232299] R10: ffffc900019c7c18 R11: 0000000000000000 R12: ffff88807f71a4f0
      [   15.233007] R13: 0000000000000000 R14: ffff88807f6dc700 R15: 0000000000000002
      [   15.233714] FS:  00007f65d9b5f700(0000) GS:ffff88807c400000(0000) knlGS:0000000000000000
      [   15.234509] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   15.235081] CR2: 0000000000223b10 CR3: 000000000b883000 CR4: 00000000000006f0
      [   15.235788] Call Trace:
      [   15.236042]  skb_release_all+0x28/0x30
      [   15.236419]  __kfree_skb+0x11/0x20
      [   15.236768]  tcp_data_queue+0x270/0x1240
      [   15.237161]  ? tcp_urg+0x50/0x2a0
      [   15.237496]  tcp_rcv_established+0x39a/0x890
      [   15.237997]  ? mark_held_locks+0x49/0x70
      [   15.238467]  tcp_v4_do_rcv+0xb9/0x270
      [   15.238915]  __release_sock+0x8a/0x160
      [   15.239365]  release_sock+0x32/0xd0
      [   15.239793]  __inet_stream_connect+0x1d2/0x400
      [   15.240313]  ? do_wait_intr_irq+0x80/0x80
      [   15.240791]  inet_stream_connect+0x36/0x50
      [   15.241275]  mptcp_stream_connect+0x69/0x1b0
      [   15.241787]  __sys_connect+0x122/0x140
      [   15.242236]  ? syscall_enter_from_user_mode+0x17/0x50
      [   15.242836]  ? lockdep_hardirqs_on_prepare+0xd4/0x170
      [   15.243436]  __x64_sys_connect+0x1a/0x20
      [   15.243924]  do_syscall_64+0x33/0x40
      [   15.244313]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      [   15.244821] RIP: 0033:0x7f65d946e469
      [   15.245183] 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
      [   15.247019] RSP: 002b:00007f65d9b5eda8 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
      [   15.247770] RAX: ffffffffffffffda RBX: 000000000049bf00 RCX: 00007f65d946e469
      [   15.248471] RDX: 0000000000000010 RSI: 00000000200000c0 RDI: 0000000000000005
      [   15.249205] RBP: 000000000049bf00 R08: 0000000000000000 R09: 0000000000000000
      [   15.249908] R10: 0000000000000000 R11: 0000000000000246 R12: 000000000049bf0c
      [   15.250603] R13: 00007fffe8a25cef R14: 00007f65d9b3f000 R15: 0000000000000003
      [   15.251312] Modules linked in:
      [   15.251626] CR2: 0000000000223b10
      [   15.251965] BUG: kernel NULL pointer dereference, address: 0000000000000048
      [   15.252005] ---[ end trace f5c51fe19123c773 ]---
      [   15.252822] #PF: supervisor read access in kernel mode
      [   15.252823] #PF: error_code(0x0000) - not-present page
      [   15.252825] PGD c6c6067 P4D c6c6067 PUD c0d8067
      [   15.253294] RIP: 0010:skb_release_data+0x89/0x1e0
      [   15.253910] PMD 0
      [   15.253914] Oops: 0000 [#2] SMP
      [   15.253917] CPU: 1 PID: 7746 Comm: syz-executor Tainted: G      D           5.10.0-rc6+ #24
      [   15.253920] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
      [   15.254435] Code: 5b 5d 41 5c 41 5d 41 5e 41 5f e9 02 06 8a ff e8 fd 05 8a ff 45 31 ed 80 7d 02 00 4c 8d 65 30 74 55 e8 eb 05 8a ff 49 8b 1c 24 <4c> 8b 7b 08 41 f6 c7 01 0f 85 18 01 00 00 e8 d4 05 8a ff 8b 43 34
      [   15.254899] RIP: 0010:skb_release_data+0x89/0x1e0
      [   15.254902] Code: 5b 5d 41 5c 41 5d 41 5e 41 5f e9 02 06 8a ff e8 fd 05 8a ff 45 31 ed 80 7d 02 00 4c 8d 65 30 74 55 e8 eb 05 8a ff 49 8b 1c 24 <4c> 8b 7b 08 41 f6 c7 01 0f 85 18 01 00 00 e8 d4 05 8a ff 8b 43 34
      [   15.254905] RSP: 0018:ffffc900019bfc08 EFLAGS: 00010293
      [   15.255376] RSP: 0018:ffffc900019c7c08 EFLAGS: 00010293
      [   15.255580]
      [   15.255583] RAX: ffff888004a7ac80 RBX: 0000000000000040 RCX: 0000000000000000
      [   15.255912]
      [   15.256724] RDX: 0000000000000000 RSI: ffffffff818e06c5 RDI: ffff88807f6ddd00
      [   15.257620] RAX: ffff88800daad900 RBX: 0000000000223b08 RCX: 0000000000000006
      [   15.259817] RBP: ffff88800e9006c0 R08: 0000000000000000 R09: 0000000000000000
      [   15.259818] R10: 0000000000000000 R11: 0000000000000000 R12: ffff88800e9006f0
      [   15.259820] R13: 0000000000000000 R14: ffff88807f6ddd00 R15: 0000000000000002
      [   15.259822] FS:  00007fae4a60a700(0000) GS:ffff88807c500000(0000) knlGS:0000000000000000
      [   15.259826] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   15.260296] RDX: 0000000000000000 RSI: ffffffff818e06c5 RDI: ffff88807f6dc700
      [   15.262514] CR2: 0000000000000048 CR3: 000000000b89c000 CR4: 00000000000006e0
      [   15.262515] Call Trace:
      [   15.262519]  skb_release_all+0x28/0x30
      [   15.262523]  __kfree_skb+0x11/0x20
      [   15.263054] RBP: ffff88807f71a4c0 R08: 0000000000000001 R09: 0000000000000001
      [   15.263680]  tcp_data_queue+0x270/0x1240
      [   15.263843] R10: ffffc900019c7c18 R11: 0000000000000000 R12: ffff88807f71a4f0
      [   15.264693]  ? tcp_urg+0x50/0x2a0
      [   15.264856] R13: 0000000000000000 R14: ffff88807f6dc700 R15: 0000000000000002
      [   15.265720]  tcp_rcv_established+0x39a/0x890
      [   15.266438] FS:  00007f65d9b5f700(0000) GS:ffff88807c400000(0000) knlGS:0000000000000000
      [   15.267283]  ? __schedule+0x3fa/0x880
      [   15.267287]  tcp_v4_do_rcv+0xb9/0x270
      [   15.267290]  __release_sock+0x8a/0x160
      [   15.268049] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   15.268788]  release_sock+0x32/0xd0
      [   15.268791]  __inet_stream_connect+0x1d2/0x400
      [   15.268795]  ? do_wait_intr_irq+0x80/0x80
      [   15.269593] CR2: 0000000000223b10 CR3: 000000000b883000 CR4: 00000000000006f0
      [   15.270246]  inet_stream_connect+0x36/0x50
      [   15.270250]  mptcp_stream_connect+0x69/0x1b0
      [   15.270253]  __sys_connect+0x122/0x140
      [   15.271097] Kernel panic - not syncing: Fatal exception
      [   15.271820]  ? syscall_enter_from_user_mode+0x17/0x50
      [   15.283542]  ? lockdep_hardirqs_on_prepare+0xd4/0x170
      [   15.284275]  __x64_sys_connect+0x1a/0x20
      [   15.284853]  do_syscall_64+0x33/0x40
      [   15.285369]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      [   15.286105] RIP: 0033:0x7fae49f19469
      [   15.286638] 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
      [   15.289295] RSP: 002b:00007fae4a609da8 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
      [   15.290375] RAX: ffffffffffffffda RBX: 000000000049bf00 RCX: 00007fae49f19469
      [   15.291403] RDX: 0000000000000010 RSI: 00000000200000c0 RDI: 0000000000000005
      [   15.292437] RBP: 000000000049bf00 R08: 0000000000000000 R09: 0000000000000000
      [   15.293456] R10: 0000000000000000 R11: 0000000000000246 R12: 000000000049bf0c
      [   15.294473] R13: 00007fff0004b6bf R14: 00007fae4a5ea000 R15: 0000000000000003
      [   15.295492] Modules linked in:
      [   15.295944] CR2: 0000000000000048
      [   15.296567] Kernel Offset: disabled
      [   15.296941] ---[ end Kernel panic - not syncing: Fatal exception ]---
      Reported-by: NChristoph Paasch <cpaasch@apple.com>
      Fixes: 84dfe367 (mptcp: send out dedicated ADD_ADDR packet)
      Signed-off-by: NGeliang Tang <geliangtang@gmail.com>
      Reviewed-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Link: https://lore.kernel.org/r/ccca4e8f01457a1b495c5d612ed16c5f7a585706.1608010058.git.geliangtang@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      3ae32c07
  16. 15 12月, 2020 1 次提交
  17. 10 12月, 2020 7 次提交
    • 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
    • G
      mptcp: print out port and ahmac when receiving ADD_ADDR · 90a4aea8
      Geliang Tang 提交于
      This patch printed out more debugging information for the ADD_ADDR
      suboption parsing on the incoming path.
      Signed-off-by: NGeliang Tang <geliangtang@gmail.com>
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      90a4aea8
    • G
      mptcp: send out dedicated packet for ADD_ADDR using port · fbe0f87a
      Geliang Tang 提交于
      The process is similar to that of the ADD_ADDR IPv6, this patch also sent
      out a pure ack for the ADD_ADDR using port.
      Signed-off-by: NGeliang Tang <geliangtang@gmail.com>
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fbe0f87a
    • G
      mptcp: add the outgoing ADD_ADDR port support · 4a2777a8
      Geliang Tang 提交于
      This patch added a new add_addr_signal type named MPTCP_ADD_ADDR_PORT,
      to identify it is an address with port to be added.
      
      It also added a new parameter 'port' for both mptcp_add_addr_len and
      mptcp_pm_add_addr_signal.
      
      In mptcp_established_options_add_addr, we check whether the announced
      address is added with port. If it is, we put this port number to
      mptcp_out_options's port field.
      Signed-off-by: NGeliang Tang <geliangtang@gmail.com>
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4a2777a8
    • G
      mptcp: add port support for ADD_ADDR suboption writing · 22fb85ff
      Geliang Tang 提交于
      In rfc8684, the length of ADD_ADDR suboption with IPv4 address and port
      is 18 octets, but mptcp_write_options is 32-bit aligned, so we need to
      pad it to 20 octets. All the other port related option lengths need to
      be added up 2 octets similarly.
      
      This patch added a new field 'port' in mptcp_out_options. When this
      field is set with a port number, we need to add up 4 octets for the
      ADD_ADDR suboption, and put the port number into the suboption.
      Signed-off-by: NGeliang Tang <geliangtang@gmail.com>
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      22fb85ff
    • G
      mptcp: unify ADD_ADDR and ADD_ADDR6 suboptions writing · e1ef6832
      Geliang Tang 提交于
      The length of ADD_ADDR6 is 12 octets longer than ADD_ADDR. That's the
      only difference between them.
      
      This patch dropped the duplicate code between ADD_ADDR and ADD_ADDR6
      suboptions writing, and unify them into one.
      Signed-off-by: NGeliang Tang <geliangtang@gmail.com>
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e1ef6832
    • G
      mptcp: unify ADD_ADDR and echo suboptions writing · 6eb3d1e3
      Geliang Tang 提交于
      There are two differences between ADD_ADDR suboption and ADD_ADDR echo
      suboption: The length of the former is 8 octets longer than the length
      of the latter. The former's echo-flag is 0, and latter's echo-flag is 1.
      
      This patch added two local variables, len and echo, to unify ADD_ADDR
      and ADD_ADDR echo suboptions writing.
      Signed-off-by: NGeliang Tang <geliangtang@gmail.com>
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6eb3d1e3
  18. 01 12月, 2020 2 次提交
  19. 21 11月, 2020 2 次提交
    • P
      mptcp: refine MPTCP-level ack scheduling · ea4ca586
      Paolo Abeni 提交于
      Send timely MPTCP-level ack is somewhat difficult when
      the insertion into the msk receive level is performed
      by the worker.
      
      It needs TCP-level dup-ack to notify the MPTCP-level
      ack_seq increase, as both the TCP-level ack seq and the
      rcv window are unchanged.
      
      We can actually avoid processing incoming data with the
      worker, and let the subflow or recevmsg() send ack as needed.
      
      When recvmsg() moves the skbs inside the msk receive queue,
      the msk space is still unchanged, so tcp_cleanup_rbuf() could
      end-up skipping TCP-level ack generation. Anyway, when
      __mptcp_move_skbs() is invoked, a known amount of bytes is
      going to be consumed soon: we update rcv wnd computation taking
      them in account.
      
      Additionally we need to explicitly trigger tcp_cleanup_rbuf()
      when recvmsg() consumes a significant amount of the receive buffer.
      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>
      ea4ca586
    • F
      mptcp: track window announced to peer · fa3fe2b1
      Florian Westphal 提交于
      OoO handling attempts to detect when packet is out-of-window by testing
      current ack sequence and remaining space vs. sequence number.
      
      This doesn't work reliably. Store the highest allowed sequence number
      that we've announced and use it to detect oow packets.
      
      Do this when mptcp options get written to the packet (wire format).
      For this to work we need to move the write_options call until after
      stack selected a new tcp window.
      Acked-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      fa3fe2b1