1. 24 Aug, 2018 2 commits
  2. 23 Aug, 2018 36 commits
  3. 22 Aug, 2018 2 commits
    • John Fastabend's avatar
      bpf: sockmap: write_space events need to be passed to TCP handler · 9b2e0388
      John Fastabend authored
      When sockmap code is using the stream parser it also handles the write
      space events in order to handle the case where (a) verdict redirects
      skb to another socket and (b) the sockmap then sends the skb but due
      to memory constraints (or other EAGAIN errors) needs to do a retry.
      
      But the initial code missed a third case where the
      skb_send_sock_locked() triggers an sk_wait_event(). A typically case
      would be when sndbuf size is exceeded. If this happens because we
      do not pass the write_space event to the lower layers we never wake
      up the event and it will wait for sndtimeo. Which as noted in ktls
      fix may be rather large and look like a hang to the user.
      
      To reproduce the best test is to reduce the sndbuf size and send
      1B data chunks to stress the memory handling. To fix this pass the
      event from the upper layer to the lower layer.
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      9b2e0388
    • John Fastabend's avatar
      tls: possible hang when do_tcp_sendpages hits sndbuf is full case · 67db7cd2
      John Fastabend authored
      Currently, the lower protocols sk_write_space handler is not called if
      TLS is sending a scatterlist via  tls_push_sg. However, normally
      tls_push_sg calls do_tcp_sendpage, which may be under memory pressure,
      that in turn may trigger a wait via sk_wait_event. Typically, this
      happens when the in-flight bytes exceed the sdnbuf size. In the normal
      case when enough ACKs are received sk_write_space() will be called and
      the sk_wait_event will be woken up allowing it to send more data
      and/or return to the user.
      
      But, in the TLS case because the sk_write_space() handler does not
      wake up the events the above send will wait until the sndtimeo is
      exceeded. By default this is MAX_SCHEDULE_TIMEOUT so it look like a
      hang to the user (especially this impatient user). To fix this pass
      the sk_write_space event to the lower layers sk_write_space event
      which in the TCP case will wake any pending events.
      
      I observed the above while integrating sockmap and ktls. It
      initially appeared as test_sockmap (modified to use ktls) occasionally
      hanging. To reliably reproduce this reduce the sndbuf size and stress
      the tls layer by sending many 1B sends. This results in every byte
      needing a header and each byte individually being sent to the crypto
      layer.
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: default avatarDave Watson <davejwatson@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      67db7cd2