Skip to content
Snippets Groups Projects
  1. Jun 02, 2022
  2. Aug 09, 2021
    • Leonid Vasiliev's avatar
      cmake: hide tarantool symbols back · 5ceabb37
      Leonid Vasiliev authored
      After unhiding all internal symbols([1]) we experience a bunch of
      problems ([2], [3]). The second one (clash of symbols from different version
      of the "small" library) still have no good solution.
      You can find more on the topic [4].
      
      The situation for tarantool executable is the same as for any other library.
      A library should expose only its public API and should not increase probability
      of hard to debug problems due to clash of a user's code with an internal name
      from the library.
      
      Let's hide all symbols by default and create a list of exported symbols.
      (In fact, this patch is a revert of the patch
      03790ac5 ([5]) taking into account the changes
      made to the code)
      
      Explanation of adding some controversial symbols to the export list:
      
      * The following symbols are used in shared libraries used in tests
        ("cfunc*.so", "sql_uuid.so", "gh-6024-funcs-return-bin.so", "function1.so",
        "gh-5938-wrong-string-length.so", "module_api.so")
      
          mp_check
          mp_encode_array
          mp_encode_bin
          mp_encode_bool
          mp_encode_int
          mp_encode_map
          mp_encode_nil
          mp_encode_str
          mp_encode_uint
          mp_decode_array_slowpath
          mp_decode_str
          mp_next_slowpath
          mp_load_u8
          mp_next
          mp_sizeof_array
          mp_sizeof_str
          mp_type_hint
          decimal_from_string
      
      * These symbols are used in "crypto.lua" and, if absent, will lead to the
        failure of the "static_build_cmake_linux" on CI (the crypto prefix was
        used to avoid the clashes of names)
      
          crypto_ERR_error_string
          crypto_ERR_get_error
          crypto_EVP_DigestInit_ex
          crypto_EVP_DigestUpdate
          crypto_EVP_DigestFinal_ex
          crypto_EVP_get_digestbyname
          crypto_HMAC_Init_ex
          crypto_HMAC_Update
          crypto_HMAC_Final
      
      * For correct work of "schema.lua" in the "static_build_cmake_linux"
      
          rl_get_screen_size
      
      * The following symbols are used in "ssl-cert-paths-discover.test.lua"
        (I think these symbols will have to be wrapped in the to avoid clashes
        problems)
      
          X509_get_default_cert_dir_env
          X509_get_default_cert_file_env
          ssl_cert_paths_discover
      
      From "exports.test.lua" have been removed ZSTD symbols checking (see [6]) and
      "tt_uuid_str" (see [7]).
      
      1. https://github.com/tarantool/tarantool/issues/2971
      2. https://github.com/tarantool/tarantool/issues/5001
      3. https://github.com/tarantool/memcached/issues/59
      4. https://lists.tarantool.org/pipermail/tarantool-discussions/2020-September/000095.html
      5. https://github.com/tarantool/tarantool/commit/03790ac5510648d1d9648bb2281857a7992d0593
      6. https://github.com/tarantool/tarantool/issues/4225
      7. https://github.com/tarantool/tarantool/commit/acf8745ed8fef47e6d1f1c31708c7c9d6324d2f3
      
      Part of #5932
      5ceabb37
  3. Mar 24, 2021
    • Vladislav Shpilevoy's avatar
      buffer: remove Lua registers · 911ca60e
      Vladislav Shpilevoy authored
      Lua buffer module used to have a couple of preallocated objects of
      type 'union c_register'. It was a bunch of C scalar and array
      types intended for use instead of ffi.new() where it was needed to
      allocate a temporary object like 'int[1]' just to be able to pass
      'int *' into a C function via FFI.
      
      It was a bit faster than ffi.new() even for small sizes. For
      instance (when JIT works), getting a register to use it as
      'int[1]' cost around 0.2-0.3 ns while ffi.new('int[1]') costs
      around 0.4 ns. Also the code looked cleaner.
      
      But Lua registers were global and therefore had the same issue as
      IBUF_SHARED and static_alloc() in Lua - no ownership, and sudden
      reuse when GC starts right the register is still in use in some
      Lua code. __gc handlers could wipe the register values making the
      original code behave unpredictably.
      
      IBUF_SHARED was fixed by proper ownership implementation, but it
      is not necessary with Lua registers. It could be done with the
      buffer.ffi_stash_new() feature, but its performance is about 0.8
      ns which is worse than plain ffi.new() for simple scalar types.
      
      This patch eliminates Lua registers, and uses ffi.new() instead
      everywhere.
      
      Closes #5632
      911ca60e
    • Vladislav Shpilevoy's avatar
      buffer: remove static_alloc() from Lua · ae1821fe
      Vladislav Shpilevoy authored
      Static_alloc() uses a fixed size circular BSS memory buffer. It is
      often used in C when need to allocate something of a size smaller
      than the static buffer temporarily. And it was thought that it
      might be also useful in Lua when backed up by ffi.new() for large
      allocations.
      
      It was useful, and faster than ffi.new() on sizes > 128 and less
      than the static buffer size, but it wasn't correct to use it. By
      the same reason why IBUF_SHARED global variable should not have
      been used as is. Because without a proper ownership the buffer
      might be reused in some unexpected way.
      
      Just like with IBUF_SHARED, the static buffer could be reused
      during Lua GC in one of __gc handlers. Essentially, at any moment
      on almost any line of a Lua script.
      
      IBUF_SHARED was fixed by proper ownership implementation, but it
      is not possible with the static buffer. Because there is no such a
      thing like a static buffer object which can be owned, and even if
      there would be, cost of its support wouldn't be much better than
      for the new cord_ibuf API. That would make the static buffer close
      to pointless.
      
      This patch eliminates static_alloc() from Lua, and uses cord_ibuf
      instead almost everywhere except a couple of places where
      ffi.new() is good enough.
      
      Part of #5632
      ae1821fe
  4. Jul 15, 2020
  5. May 21, 2019
    • Vladislav Shpilevoy's avatar
      swim: swim:set_codec() Lua API · 2dc1af75
      Vladislav Shpilevoy authored
      Encryption with an arbitrary algorithm and any mode with a
      configurable private key.
      
      Closes #3234
      2dc1af75
    • Vladislav Shpilevoy's avatar
      buffer: replace all ffi.new(type[1]) with cached union · a2c19aa8
      Vladislav Shpilevoy authored
      Lua, which suffers from lack of ability to pass values by
      pointers into FFI functions, nor has an address operator '&' to
      take an address of integer or char or anything. Because of that
      a user need to either use ffi.new(type[1]) or use static buffer,
      but for such small allocations they are both too expensive and
      aggravate GC problem.
      
      Now buffer module provides preallocated basic types to use in FFI
      functions. The commit is motivated by one another place where
      ffi.new('int[1]') appeared, in SWIM module, to obtain payload
      size as an out parameter of a C function.
      a2c19aa8
  6. May 15, 2019
  7. Mar 19, 2019
    • Alexander Turenko's avatar
      lua: remove digest.sha() and digest.sha_hex() · 390693a1
      Alexander Turenko authored
      SHA-0 is considered weak for years and was removed in OpenSSL since
      1.1.0.
      
      These Lua functions did not work since 15ed10e4, but give 'Digest
      method "sha" is not supported' error for any input. Removed them to
      don't confuse a user with a Tab completion.
      
      Follow up #1722.
      Fixes #4028.
      390693a1
  8. Jun 16, 2017
  9. Feb 20, 2017
  10. Sep 28, 2016
  11. Aug 31, 2016
  12. May 05, 2016
  13. Apr 06, 2016
  14. Mar 17, 2016
  15. Mar 15, 2016
  16. Mar 04, 2016
Loading