1. 23 1月, 2018 1 次提交
  2. 18 1月, 2018 4 次提交
    • S
      tls: reset crypto_info when do_tls_setsockopt_tx fails · 6db959c8
      Sabrina Dubroca 提交于
      The current code copies directly from userspace to ctx->crypto_send, but
      doesn't always reinitialize it to 0 on failure. This causes any
      subsequent attempt to use this setsockopt to fail because of the
      TLS_CRYPTO_INFO_READY check, eventhough crypto_info is not actually
      ready.
      
      This should result in a correctly set up socket after the 3rd call, but
      currently it does not:
      
          size_t s = sizeof(struct tls12_crypto_info_aes_gcm_128);
          struct tls12_crypto_info_aes_gcm_128 crypto_good = {
              .info.version = TLS_1_2_VERSION,
              .info.cipher_type = TLS_CIPHER_AES_GCM_128,
          };
      
          struct tls12_crypto_info_aes_gcm_128 crypto_bad_type = crypto_good;
          crypto_bad_type.info.cipher_type = 42;
      
          setsockopt(sock, SOL_TLS, TLS_TX, &crypto_bad_type, s);
          setsockopt(sock, SOL_TLS, TLS_TX, &crypto_good, s - 1);
          setsockopt(sock, SOL_TLS, TLS_TX, &crypto_good, s);
      
      Fixes: 3c4d7559 ("tls: kernel TLS support")
      Signed-off-by: NSabrina Dubroca <sd@queasysnail.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6db959c8
    • S
      tls: return -EBUSY if crypto_info is already set · 877d17c7
      Sabrina Dubroca 提交于
      do_tls_setsockopt_tx returns 0 without doing anything when crypto_info
      is already set. Silent failure is confusing for users.
      
      Fixes: 3c4d7559 ("tls: kernel TLS support")
      Signed-off-by: NSabrina Dubroca <sd@queasysnail.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      877d17c7
    • S
      tls: fix sw_ctx leak · cf6d43ef
      Sabrina Dubroca 提交于
      During setsockopt(SOL_TCP, TLS_TX), if initialization of the software
      context fails in tls_set_sw_offload(), we leak sw_ctx. We also don't
      reassign ctx->priv_ctx to NULL, so we can't even do another attempt to
      set it up on the same socket, as it will fail with -EEXIST.
      
      Fixes: 3c4d7559 ('tls: kernel TLS support')
      Signed-off-by: NSabrina Dubroca <sd@queasysnail.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cf6d43ef
    • I
      net/tls: Only attach to sockets in ESTABLISHED state · d91c3e17
      Ilya Lesokhin 提交于
      Calling accept on a TCP socket with a TLS ulp attached results
      in two sockets that share the same ulp context.
      The ulp context is freed while a socket is destroyed, so
      after one of the sockets is released, the second second will
      trigger a use after free when it tries to access the ulp context
      attached to it.
      We restrict the TLS ulp to sockets in ESTABLISHED state
      to prevent the scenario above.
      
      Fixes: 3c4d7559 ("tls: kernel TLS support")
      Reported-by: syzbot+904e7cd6c5c741609228@syzkaller.appspotmail.com
      Signed-off-by: NIlya Lesokhin <ilyal@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d91c3e17
  3. 16 1月, 2018 1 次提交
  4. 14 11月, 2017 6 次提交
  5. 15 9月, 2017 1 次提交
  6. 06 7月, 2017 1 次提交
  7. 24 6月, 2017 1 次提交
  8. 18 6月, 2017 1 次提交
    • D
      tls: update Kconfig · d807ec65
      Dave Watson 提交于
      Missing crypto deps for some platforms.
      Default to n for new module.
      
      config: m68k-amcore_defconfig (attached as .config)
      compiler: m68k-linux-gcc (GCC) 4.9.0
      
      make.cross ARCH=m68k
      All errors (new ones prefixed by >>):
      
         net/built-in.o: In function `tls_set_sw_offload':
      >> (.text+0x732f8): undefined reference to `crypto_alloc_aead'
         net/built-in.o: In function `tls_set_sw_offload':
      >> (.text+0x7333c): undefined reference to `crypto_aead_setkey'
         net/built-in.o: In function `tls_set_sw_offload':
      >> (.text+0x73354): undefined reference to `crypto_aead_setauthsize'
      Reported-by: Nkbuild test robot <fengguang.wu@intel.com>
      Signed-off-by: NDave Watson <davejwatson@fb.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d807ec65
  9. 16 6月, 2017 2 次提交