1. 15 11月, 2021 1 次提交
    • W
      net/smc: Transfer remaining wait queue entries during fallback · 2153bd1e
      Wen Gu 提交于
      The SMC fallback is incomplete currently. There may be some
      wait queue entries remaining in smc socket->wq, which should
      be removed to clcsocket->wq during the fallback.
      
      For example, in nginx/wrk benchmark, this issue causes an
      all-zeros test result:
      
      server: nginx -g 'daemon off;'
      client: smc_run wrk -c 1 -t 1 -d 5 http://11.200.15.93/index.html
      
        Running 5s test @ http://11.200.15.93/index.html
           1 threads and 1 connections
           Thread Stats   Avg      Stdev     Max   ± Stdev
           	Latency     0.00us    0.00us   0.00us    -nan%
      	Req/Sec     0.00      0.00     0.00      -nan%
      	0 requests in 5.00s, 0.00B read
           Requests/sec:      0.00
           Transfer/sec:       0.00B
      
      The reason for this all-zeros result is that when wrk used SMC
      to replace TCP, it added an eppoll_entry into smc socket->wq
      and expected to be notified if epoll events like EPOLL_IN/
      EPOLL_OUT occurred on the smc socket.
      
      However, once a fallback occurred, wrk switches to use clcsocket.
      Now it is clcsocket->wq instead of smc socket->wq which will
      be woken up. The eppoll_entry remaining in smc socket->wq does
      not work anymore and wrk stops the test.
      
      This patch fixes this issue by removing remaining wait queue
      entries from smc socket->wq to clcsocket->wq during the fallback.
      
      Link: https://www.spinics.net/lists/netdev/msg779769.htmlSigned-off-by: NWen Gu <guwen@linux.alibaba.com>
      Reviewed-by: NTony Lu <tonylu@linux.alibaba.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2153bd1e
  2. 10 11月, 2021 1 次提交
    • D
      net/smc: fix sk_refcnt underflow on linkdown and fallback · e5d5aadc
      Dust Li 提交于
      We got the following WARNING when running ab/nginx
      test with RDMA link flapping (up-down-up).
      The reason is when smc_sock fallback and at linkdown
      happens simultaneously, we may got the following situation:
      
      __smc_lgr_terminate()
       --> smc_conn_kill()
          --> smc_close_active_abort()
                 smc_sock->sk_state = SMC_CLOSED
                 sock_put(smc_sock)
      
      smc_sock was set to SMC_CLOSED and sock_put() been called
      when terminate the link group. But later application call
      close() on the socket, then we got:
      
      __smc_release():
          if (smc_sock->fallback)
              smc_sock->sk_state = SMC_CLOSED
              sock_put(smc_sock)
      
      Again we set the smc_sock to CLOSED through it's already
      in CLOSED state, and double put the refcnt, so the following
      warning happens:
      
      refcount_t: underflow; use-after-free.
      WARNING: CPU: 5 PID: 860 at lib/refcount.c:28 refcount_warn_saturate+0x8d/0xf0
      Modules linked in:
      CPU: 5 PID: 860 Comm: nginx Not tainted 5.10.46+ #403
      Hardware name: Alibaba Cloud Alibaba Cloud ECS, BIOS 8c24b4c 04/01/2014
      RIP: 0010:refcount_warn_saturate+0x8d/0xf0
      Code: 05 5c 1e b5 01 01 e8 52 25 bc ff 0f 0b c3 80 3d 4f 1e b5 01 00 75 ad 48
      
      RSP: 0018:ffffc90000527e50 EFLAGS: 00010286
      RAX: 0000000000000026 RBX: ffff8881300df2c0 RCX: 0000000000000027
      RDX: 0000000000000000 RSI: ffff88813bd58040 RDI: ffff88813bd58048
      RBP: 0000000000000000 R08: 0000000000000003 R09: 0000000000000001
      R10: ffff8881300df2c0 R11: ffffc90000527c78 R12: ffff8881300df340
      R13: ffff8881300df930 R14: ffff88810b3dad80 R15: ffff8881300df4f8
      FS:  00007f739de8fb80(0000) GS:ffff88813bd40000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 000000000a01b008 CR3: 0000000111b64003 CR4: 00000000003706e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       smc_release+0x353/0x3f0
       __sock_release+0x3d/0xb0
       sock_close+0x11/0x20
       __fput+0x93/0x230
       task_work_run+0x65/0xa0
       exit_to_user_mode_prepare+0xf9/0x100
       syscall_exit_to_user_mode+0x27/0x190
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      This patch adds check in __smc_release() to make
      sure we won't do an extra sock_put() and set the
      socket to CLOSED when its already in CLOSED state.
      
      Fixes: 51f1de79 (net/smc: replace sock_put worker by socket refcounting)
      Signed-off-by: NDust Li <dust.li@linux.alibaba.com>
      Reviewed-by: NTony Lu <tonylu@linux.alibaba.com>
      Signed-off-by: NDust Li <dust.li@linux.alibaba.com>
      Acked-by: NKarsten Graul <kgraul@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e5d5aadc
  3. 01 11月, 2021 1 次提交
  4. 28 10月, 2021 1 次提交
  5. 16 10月, 2021 4 次提交
  6. 14 9月, 2021 2 次提交
  7. 09 8月, 2021 1 次提交
  8. 30 6月, 2021 1 次提交
  9. 17 6月, 2021 2 次提交
  10. 06 5月, 2021 1 次提交
    • C
      smc: disallow TCP_ULP in smc_setsockopt() · 86214366
      Cong Wang 提交于
      syzbot is able to setup kTLS on an SMC socket which coincidentally
      uses sk_user_data too. Later, kTLS treats it as psock so triggers a
      refcnt warning. The root cause is that smc_setsockopt() simply calls
      TCP setsockopt() which includes TCP_ULP. I do not think it makes
      sense to setup kTLS on top of SMC sockets, so we should just disallow
      this setup.
      
      It is hard to find a commit to blame, but we can apply this patch
      since the beginning of TCP_ULP.
      
      Reported-and-tested-by: syzbot+b54a1ce86ba4a623b7f0@syzkaller.appspotmail.com
      Fixes: 734942cc ("tcp: ULP infrastructure")
      Cc: John Fastabend <john.fastabend@gmail.com>
      Signed-off-by: NKarsten Graul <kgraul@linux.ibm.com>
      Signed-off-by: NCong Wang <cong.wang@bytedance.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      86214366
  11. 28 4月, 2021 1 次提交
  12. 02 12月, 2020 3 次提交
  13. 20 11月, 2020 1 次提交
  14. 01 11月, 2020 1 次提交
    • K
      net/smc: improve return codes for SMC-Dv2 · 3752404a
      Karsten Graul 提交于
      To allow better problem diagnosis the return codes for SMC-Dv2 are
      improved by this patch. A few more CLC DECLINE codes are defined and
      sent to the peer when an SMC connection cannot be established.
      There are now multiple SMC variations that are offered by the client and
      the server may encounter problems to initialize all of them.
      Because only one diagnosis code can be sent to the client the decision
      was made to send the first code that was encountered. Because the server
      tries the variations in the order of importance (SMC-Dv2, SMC-D, SMC-R)
      this makes sure that the diagnosis code of the most important variation
      is sent.
      
      v2: initialize rc in smc_listen_v2_check().
      Signed-off-by: NKarsten Graul <kgraul@linux.ibm.com>
      Link: https://lore.kernel.org/r/20201031181938.69903-1-kgraul@linux.ibm.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      3752404a
  15. 27 10月, 2020 1 次提交
  16. 10 10月, 2020 3 次提交
  17. 04 10月, 2020 1 次提交
  18. 29 9月, 2020 11 次提交
  19. 18 9月, 2020 1 次提交
  20. 11 9月, 2020 2 次提交