Skip to content
Snippets Groups Projects
  1. Jan 19, 2024
    • Ilya Verbin's avatar
      box: replace malloc with xmalloc in index_def_dup · 75b5a7a9
      Ilya Verbin authored
      And remove unused index_def_check_xc().
      
      As index_def_dup() never returns NULL anymore, change index_create() and
      index_read_view_create() return type to `void` and update their callers.
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      
      (cherry picked from commit f6d61754)
      75b5a7a9
    • Sergey Bronnikov's avatar
      test/fuzz: collect and print Lua metrics · c56c60ad
      Sergey Bronnikov authored
      Fuzzing test for LuaJIT generates random Lua programs and executes them.
      We want to build a fuzzing test that will produce Lua programs that will
      not contain semantic errors and will trigger as much as possible
      components in LuaJIT.
      
      This proposed patch introduces metrics that gathered after running the
      test. LuaJIT metrics gathered using LuaJIT getmetrics module [1]. All
      gathered metrics test will output after running with a finite number of
      runs or finite duration of time (options `-runs` and `-max_total_time`)
      or after sending SIGUSR1 to a test process.
      
      ```
      $ ./build/test/fuzz/luaL_loadbuffer/luaL_loadbuffer_fuzzer -runs=1000
      
      <snipped>
      
      Done 1000 runs in 1 second(s)
      Total number of samples: 1000
      Total number of samples with errors: 438 (43%)
      Total number of samples with recorded traces: 87 (8%)
      Total number of samples with snap restores: 30 (3%)
      Total number of samples with abort traces: 55 (5%)
      ```
      
      1. https://www.tarantool.io/en/doc/latest/reference/tooling/luajit_getmetrics/#getmetrics-c-api
      
      NO_CHANGELOG=testing
      NO_DOC=testing
      c56c60ad
    • Ilya Verbin's avatar
      core: fix ASAN_START_SWITCH_FIBER() usage · e78cd6a9
      Ilya Verbin authored
      The `__sanitizer_start_switch_fiber()` function takes a pointer as the
      first argument to store the current fake stack if there is one (it is
      necessary when stack-use-after-return detection is enabled). When leaving a
      fiber definitely, NULL must be passed so that the fake stack is destroyed.
      
      Before this patch, NULL was passed for dead fibers, however this is wrong
      for dead fibers that are recycled and resumed. In such cases ASAN destroys
      the fake stack, and the fiber crashes trying to use it in `fiber_yield()`
      upon return from `coro_transfer()`.
      
      Closes tarantool/tarantool-qa#321
      
      NO_DOC=bugfix
      NO_TEST=tested by test-release-asan workflow
      
      (cherry picked from commit 72a6abee)
      e78cd6a9
    • Vladimir Davydov's avatar
      box: fix box.iproto.override crash if used before box.cfg · bbeed8bf
      Vladimir Davydov authored
      The function can't be called on an unconfigured instance because it
      needs IPROTO threads up and running. Let's raise an error to avoid
      a crash.
      
      Since we have two other places where we need to raise the same error
      (box.session.su and box.__index), let's introduce the new code
      ER_UNCONFIGURED for this error.
      
      Closes #8975
      
      NO_DOC=bug fix
      
      (cherry picked from commit 4fd2686e)
      bbeed8bf
    • Ilya Verbin's avatar
      box: pin coll_id by space format and by indexes · 95740f99
      Ilya Verbin authored
      Pin in cache the collation identifiers that are referenced by space format
      and/or indexes, so that they can't be deleted.
      
      Closes #4544
      
      NO_DOC=bugfix
      
      (cherry picked from commit d69aa687)
      95740f99
    • Ilya Verbin's avatar
      box: reference collation by key_def parts · 1e4a29a5
      Ilya Verbin authored
      It was possible to delete a collation, which is in use by a key_def.
      
      Part of #4544
      
      NO_DOC=bugfix
      NO_CHANGELOG=next commit
      
      (cherry picked from commit 07beb340)
      1e4a29a5
    • Magomed Kostoev's avatar
      box: fix invalid memory access in tuple_compare_with_key_sequential · a60101b1
      Magomed Kostoev authored
      Since number type was introduced we can not assume if tuples are
      equal by comparison then their sizes are equal too. So the place
      the assumption is used is fixed.
      
      Closes #8899
      
      NO_DOC=bugfix
      
      (cherry picked from commit f4de9faf)
      a60101b1
    • Yaroslav Lobankov's avatar
      ci: bump Clang version to 16 in release build LTO testing · fcbffd16
      Yaroslav Lobankov authored
      Run release build LTO testing inside a Docker container created from the
      `tarantool/testing:ubuntu-jammy-clang16` image with Clang 16 installed.
      
      Closes #318
      
      NO_DOC=ci
      NO_TEST=ci
      NO_CHANGELOG=ci
      
      (cherry picked from commit 9d0cb54f)
      fcbffd16
    • Yaroslav Lobankov's avatar
      ci: bump Clang version to 16 in release build testing · d796e034
      Yaroslav Lobankov authored
      Run release build testing inside a Docker container created from the
      `tarantool/testing:ubuntu-jammy-clang16` image with Clang 16 installed.
      
      Closes #317
      
      NO_DOC=ci
      NO_TEST=ci
      NO_CHANGELOG=ci
      
      (cherry picked from commit 9134dabd)
      d796e034
    • Sergey Vorontsov's avatar
      build: change BACKUP_STORAGE URL for static build · cc62f842
      Sergey Vorontsov authored
      NO_DOC=build
      NO_TEST=build
      NO_CHANGELOG=build
      
      (cherry picked from commit bb74d6c9)
      cc62f842
    • Kirill Yukhin's avatar
      Add owners for /.test.mk and /.github · 446eccd8
      Kirill Yukhin authored
      Add code owners for CI-related script and
      for github automation directory.
      
      NO_CHANGELOG=no code changes
      NO_TEST=no code changes
      NO_DOC=no code changes
      
      (cherry picked from commit 9234763a)
      446eccd8
    • Kirill Yukhin's avatar
      Add owners for test/ and test-run/ · 3acbbd82
      Kirill Yukhin authored
      In order to improve tests of Tarantool core
      assign dedicated team to perform review of each
      and every change.
      
      NO_CHANGELOG=no code changes
      NO_TEST=no code changes
      NO_DOC=no code changes
      
      (cherry picked from commit 532bada7)
      3acbbd82
    • Kirill Yukhin's avatar
      Add CODEOWNERS file · b6b4bb48
      Kirill Yukhin authored
      To make changelog preparation less stressful let's pass each and every
      change to changelogs/ directly through the doc team.
      
      NO_CHANGELOG=no code changes
      NO_TEST=no code changes
      NO_DOC=no code changes
      
      (cherry picked from commit 2970bd57)
      b6b4bb48
    • Aleksandr Lyapunov's avatar
      box: forbid foreign keys for incompatible temp/local spaces · eaae86f7
      Aleksandr Lyapunov authored
      There must be a couple of rules:
      * foreign key from non-temporary space to temporary space must be
        forbidden since after restart all existing links will be broken.
      * foreign key from non-local space to local space must be forbidden
        on any replica all existing can be broken.
      
      This patch implements the rules.
      
      Closes #8936
      
      NO_DOC=bugfix
      
      (cherry picked from commit 7d23b339)
      eaae86f7
    • Aleksandr Lyapunov's avatar
      box: loose truncate check in case of foreign key · cb0b51d6
      Aleksandr Lyapunov authored
      In #7309 a truncation of a space that was referenced by foreign
      key from some other space was prohibited.
      
      It appeared that this solution is too bothering since a user can't
      truncate a space even if he truncated referring space before that.
      
      Fix it by allowing space truncate if referring spaces are empty.
      Also allow drop of the primary index in the same case with the
      same reason: logically the index along with all space data is
      not needed for consistency if there's no referring data.
      
      Note that by design space truncate is implemented quite similar
      to space drop. Both delete all indexes, from secondary to primary.
      Since this patch allows deletion of the primary index (which is
      the action that actually deletes all data from the space), this
      patch changes the result of space drop too: the space remains
      alive with no indexes, while before this patch it remained alive
      with no secondary indexes but with present primary. In both cases
      the behaviour is quite strange and must be fixed in #4348. To
      make tests pass I had to perform drop in box.atomic manually.
      
      Closes #8946
      
      NO_DOC=bugfix
      
      (cherry picked from commit 983a7ec2)
      cb0b51d6
    • Vladimir Davydov's avatar
      test: increase max fiber slice for box/before_replace · b2bccf7c
      Vladimir Davydov authored
      The test fails on osx_debug quite frequently with the following error:
      
      NO_WRAP
      > box/before_replace.test.lua                                     [ fail ]
      >
      > Test failed! Result content mismatch:
      > --- box/before_replace.result	Mon Aug  7 10:36:06 2023
      > +++ /tmp/t/rejects/box/before_replace.reject	Mon Aug  7 10:42:03 2023
      > @@ -899,6 +899,7 @@
      >  ...
      >  for i = 1,17 do gen_inserts() end
      >  ---
      > +- error: fiber slice is exceeded
      >  ...
      >  test_run:cmd('restart server test')
      >  s = box.space.test_on_schema_init
      > @@ -906,7 +907,7 @@
      >  ...
      >  s:count()
      >  ---
      > -- 1
      > +- 0
      >  ...
      >  -- For this test the number of invocations of the before_replace
      >  -- trigger during recovery multiplied by the amount of return values
      > @@ -921,7 +922,8 @@
      >  -- the value is only increased by 1, and this change is visible only in memory.
      >  s:get{1}[2] == 1 + 16999 + 17000 + 1 or s:get{1}[2]
      >  ---
      > -- true
      > +- error: '[string "return s:get{1}[2] == 1 + 16999 + 17000 + 1 o..."]:1: attempt to
      > +    index a nil value'
      >  ...
      >  test_run:cmd('switch default')
      >  ---
      NO_WRAP
      
      Let's try to increase the max fiber slice up to 15 seconds to avoid
      that, like we do in other potentially long tests. (The default value
      is 1 second.)
      
      NO_DOC=test fix
      NO_CHANGELOG=test fix
      
      (cherry picked from commit 371d4110)
      b2bccf7c
    • Vladimir Davydov's avatar
      memtx: assert that space is not NULL in index_read_view_create · f05128f7
      Vladimir Davydov authored
      This should suppress the following coverity issues:
      
      https://scan7.scan.coverity.com/reports.htm#v39198/p13437/fileInstanceId=146712118&defectInstanceId=18978766&mergedDefectId=1563095
      https://scan7.scan.coverity.com/reports.htm#v39198/p13437/fileInstanceId=146712113&defectInstanceId=18978750&mergedDefectId=1563094
      
      While we are at it, let's use space_by_id instead of space_cache_find
      because read view creation is a rare operation affecting all spaces so
      caching the last space by id doesn't make any sense.
      
      NO_DOC=code health
      NO_TEST=code health
      NO_CHANGELOG=code health
      
      (cherry picked from commit f2886dd0)
      f05128f7
    • Igor Munkin's avatar
      asan: enable ASan and LSan support for LuaJIT back · d4486591
      Igor Munkin authored
      All LuaJIT related LSan warnings were suppressed in the scope of the
      commit 985548e4 ("asan: suppress all
      LSAN warnings related to LuaJIT"), since all compiler flags tweaks were
      enclosed in LuaJIT CMake machinery. As a result of the commit in LuaJIT
      submodule tarantool/luajit@a86e376 ("build: introduce LUAJIT_USE_ASAN
      option") ASan and LSan support has been finally added to LuaJIT runtime,
      so it was decided to remove LSan suppressions for LuaJIT functions.
      Unfortunately, it was not so easy as it looked like.
      
      At first, Lua global state is not closed properly at Tarantool instance
      exit (see <tarantool_free> in src/main.cc and <tarantool_lua_free> in
      src/lua/init.c for more info), so LSan false-positive leaks are detected
      (for more info, see #3071). Hence, the original LSan suppression for
      lj_BC_FUNCC is returned back (temporarily) until the aforementioned
      issue is not resolved.
      
      Furthermore, the internal LuaJIT memory allocator is not instrumented
      yet, so to find any memory faults it's worth building LuaJIT with system
      provided memory allocator (i.e. enable LUAJIT_USE_SYSMALLOC option).
      However, again, since Tarantool doesn't finalize Lua universe the right
      way, so running Tarantool testing routine with LUAJIT_USE_SYSMALLOC
      enabled generates false-positive LSan leaks. Return back here to enable
      LUAJIT_USE_SYSMALLOC, when #3071 is resolved.
      
      Last but not least, the default value of fiber stack size is 512Kb, but
      several tests in test/PUC-Rio-Lua-5.1-test suite in LuaJIT submodule
      (e.g. some cases with deep recursion in errors.lua or pm.lua) have
      already been tweaked according to the limitations mentioned in #5782,
      but the crashes still occur while running LuaJIT tests with ASan support
      enabled. Experiments once again confirm the notorious quote that "640 Kb
      ought to be enough for anybody".
      
      Anyway, LuaJIT tests are added to <test-release-asan> target in .test.mk
      and LUAJIT_TEST_ENV is extended with required ASan and LSan options.
      
      Follows up #5878
      
      NO_DOC=ci
      NO_TEST=ci
      NO_CHANGELOG=ci
      
      (cherry picked from commit bacf4e56)
      d4486591
    • Vladimir Davydov's avatar
      compat: move is_new and is_old option methods to metatable · 01270b2f
      Vladimir Davydov authored
      The is_new and is_old methods are the same for all compat options so
      they should be defined in a metatable. A good thing about this change
      is that it removes is_new and is_old from serialization:
      
      * Before:
      
      NO_WRAP
        tarantool> require('compat').yaml_pretty_multiline
        ---
        - is_new: 'function: 0x4175d6e8'
          is_old: 'function: 0x4175d790'
          brief: |
            Whether to encode in block scalar style all multiline strings or ones
            containing "\n\n" substring. The new behavior makes all multiline string output
            as single text block which is handier for the reader, but may be incompatible
            with some existing applications that rely on the old style.
      
            https://tarantool.io/compat/yaml_pretty_multiline
          current: default
          default: new
        ...
      NO_WRAP
      
      * After:
      
      NO_WRAP
        tarantool> require('compat').yaml_pretty_multiline
        ---
        - current: default
          brief: |
            Whether to encode in block scalar style all multiline strings or ones
            containing "\n\n" substring. The new behavior makes all multiline string output
            as single text block which is handier for the reader, but may be incompatible
            with some existing applications that rely on the old style.
      
            https://tarantool.io/compat/yaml_pretty_multiline
          default: new
        ...
      NO_WRAP
      
      To achieve that, we have to remove the option name from the usage error
      message but it seems to be okay because such errors shouldn't happen in
      practice and the error message is clear enough to figure out what went
      wrong.
      
      Follow-up #8807
      
      NO_DOC=refactoring
      NO_CHANGELOG=refactoring
      
      (cherry picked from commit 75b5fd05)
      01270b2f
    • Serge Petrenko's avatar
      applier: fix use after free · 66dc4e59
      Serge Petrenko authored
      Applier thread uses lsregion to allocate the messages for tx thread. The
      messages are freed upon return to the applier thread using a
      corresponding lsr_id.
      
      Due to a typo, one of the lsregion allocations was made with a postfix
      increment of lsr_id instead of the prefix one. Essentially, part of a
      new message was allocated with an old lsr_id, and might be freed early
      by a return of a previous message.
      
      Fix this.
      
      Closes #8848
      
      NO_DOC=bugfix
      NO_TEST=covered by asan in #8901
      NO_CHANGELOG=bugfix
      
      (cherry picked from commit 0d5bd6b7)
      66dc4e59
    • Nikita Zheleztsov's avatar
      relay: fix unterminated final_join thread · 040cd9e3
      Nikita Zheleztsov authored
      
      Currently if tarantool exits during relay's final join stage,
      corresponding thread isn't terminated. This causes the flakiness
      of the replicaset_ro_mostly.test.lua.
      
      Let's reuse the same relay, in which subscribe cord is running, for
      the final join stage. This way the cord will be cancelled during
      replication_free().
      
      Closes #8082
      
      NO_DOC=not user-visible
      NO_TEST=fix flaky test
      NO_CHANGELOG=not user-visible
      
      Co-authored-by: default avatarSergey Petrenko <sergepetrenko@tarantool.org>
      
      (cherry picked from commit 70a68836)
      040cd9e3
    • Vladimir Davydov's avatar
      git: add diff=cpp attribute for C/C++ source files · 6148e590
      Vladimir Davydov authored
      This improves diff hunk name detection. Needed for checkpatch to
      correctly detect if patched code belongs to a function.
      
      NO_DOC=git
      NO_TEST=git
      NO_CHANGELOG=git
      
      (cherry picked from commit 642584fd)
      6148e590
    • Mergen Imeev's avatar
      sql: fix wrong region allocation · 9fef276e
      Mergen Imeev authored
      This patch fixes an issue in generate_column_metadata(). Prior to this
      patch, the number of variable-only expressions was counted incorrectly
      when temporary memory was allocated on region to store their positions.
      However, although this allocation was incorrect, this did not lead to
      any problems due to the specifics of the region allocations.
      
      This patch fixes this by removing the temporary memory allocation.
      
      Closes #8763
      
      NO_DOC=no user-visible changes
      NO_TEST=no user-visible changes
      NO_CHANGELOG=no user-visible changes
      
      (cherry picked from commit d4f143ad)
      9fef276e
    • Georgy Moiseev's avatar
      msgpack: fix decoding intervals with int64 · aa48086c
      Georgy Moiseev authored
      It is possible for interval to have days, hours, minutes and seconds
      larger than INT_MAX (or less than INT_MIN). Before this patch, msgpack
      decoding had failed to parse intervals with msgpack int64 and uint64.
      int64_t should be enough to store any value allowed for datetime
      intervals.
      
      Closes #8887
      
      NO_DOC=small bug fix
      
      (cherry picked from commit 01c7ae11)
      aa48086c
    • Sergey Kaplun's avatar
      lua: replace `api_check()` with `assert()` · e5a18019
      Sergey Kaplun authored
      `api_check()` is the LuaJIT internal assertion. To prevent inconsistency
      during internal assertion changes (for example, during backporting), use
      glibc's `assert()` instead.
      
      NO_DOC=internal
      NO_TEST=internal
      NO_CHANGELOG=internal
      
      (cherry picked from commit e78afb3b)
      e5a18019
    • Igor Munkin's avatar
      luajit: bump new version · f259e74a
      Igor Munkin authored
      * FFI: Fix recording of union initialization.
      * Fix maxslots when recording BC_VARG, part 2.
      * Fix maxslots when recording BC_VARG.
      * Fix BC_UCLO insertion for returns.
      * ci: update job concurrency group definition
      
      Part of #8825
      
      NO_DOC=LuaJIT submodule bump
      NO_TEST=LuaJIT submodule bump
      f259e74a
    • Georgy Moiseev's avatar
      datetime: allow boundary values for interval.new · c369dd8f
      Georgy Moiseev authored
      Before this patch, one couldn't create new datetime interval with
      boundary value from Lua. At the same time, it was possible to create
      such interval from Lua through addition and subtraction. C range
      verification allow to create boundary value intervals, error message
      also implies that they should be allowed. (See #8878 for more info.)
      
      Closes #8878
      
      NO_DOC=small bug fix
      
      (cherry picked from commit b2a001cc)
      c369dd8f
    • Rimma Tolkacheva's avatar
      test/fuzz: refactor LuaJIT fuzzer · e08a0c7c
      Rimma Tolkacheva authored
      This refactoring will:
      
      1. Move macros from a header to the source file.
      Macros should be used in header only with undef to avoid redefinitions.
      Undef directive is not useful since we want to use these macros in the
      source file.
      
      2. Remove `using namespace lua_grammar` from header.
      https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rs-using-directive
      
      3. Moving serializer entry point and constant parameters into
      luajit_fuzzer namespace.
      It's a common practice in C++ to avoid name collisions.
      
      4. Move serializer functions into anonymous namespace.
      These functions are not a part of the interface so should have
      static linkage.
      https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rs-unnamed2
      
      5. Fix ConvertToStringDefault function.
      It was logically wrong so it would generate an identifier `123` from
      `*123`.
      
      NO_CHANGELOG=internal
      NO_DOC=fuzzer fix
      
      (cherry picked from commit 56488e15)
      e08a0c7c
    • klauwier's avatar
      test/fuzz: fix luaJIT fuzzer timeout · 89cbb737
      klauwier authored
      LuaJIT fuzzer used to stop due to timeout caused by infinite cycles and
      recursions. Counters were introduced for every cycle and function to
      address LuaJIT fuzzer timeouts.
      
      The idea is to add unique counters for every cycle and function to
      ensure finite code execution, if it wasn't already. For while, repeat,
      for cycles, local and global named, anonymous functions, counters will
      be initialized before the code generated from protobuf, and checked
      in the first body statement. An entry point for the serializer was
      created to count cycles and functions for counter initialization.
      
      The idea was taken from a paper "Program Reconditioning: Avoiding
      Undefined Behaviour When Finding and Reducing Compiler Bugs" [1].
      
      Here is an example of a change in serialized code made by this commit.
      
      Before:
      ```lua
      while (true) do
          foo = 'bar'
      end
      function bar()
          bar()
      end
      ```
      
      After:
      ```lua
      counter_0 = 0
      counter_1 = 0
      while (true) do
          if counter_0 > 5 then
              break
          end
          counter_0 = counter_0 + 1
          foo = 'bar'
      end
      function bar()
          if counter_1 > 5 then
              return
          end
          counter_1 = counter_1 + 1
          bar()
      end
      ```
      Protobuf structures that reproduce the timeout problem were added to
      the LuaJIT fuzzer corpus.
      
      [1] https://www.doc.ic.ac.uk/~afd/homepages/papers/pdfs/2023/PLDI.pdf
      
      NO_CHANGELOG=internal
      NO_DOC=fuzzer fix
      
      (cherry picked from commit 4d004bbe)
      89cbb737
    • klauwier's avatar
      test/fuzz: add breaks to switch-case · 53bed159
      klauwier authored
      Cases in two switches had no breaks, so they were falling
      through. Breaks were added to solve the problem. Code
      generated by the LuaJIT fuzzer became more various.
      
      NO_CHANGELOG=internal
      NO_DOC=fuzzer fix
      
      (cherry picked from commit 4430cac9)
      53bed159
    • Sergey Bronnikov's avatar
      cmake: propagate CMAKE_BUILD_TYPE for ProtobufMutator · 8cb37b89
      Sergey Bronnikov authored
      Follows-up #4823
      
      NO_CHANGELOG=internal
      NO_DOC=internal
      NO_TEST=internal
      
      (cherry picked from commit 95d62cfc)
      8cb37b89
    • Sergey Bronnikov's avatar
      test/fuzz: fix datetime_strptime fuzzing test · 9304de91
      Sergey Bronnikov authored
      Function `datetime_strptime` decodes string with datetime according to
      specified format, it accepts a datetime struct, buffer with datetime and
      string with format in arguments. Fuzzing test used static string
      "iso8601" as a format and it blocked fuzzing test to cover functions
      used by datetime_strptime under the hood. Fuzz introspector shows that
      code coveraged by a test is quite low.
      
      Patch updates the test to make it more effective: buffer with datetime
      and format string are generated using FDP (Fuzzing Data Provider).
      
      Test file extension was changed to .cc, because FuzzingDataProvider is
      used and we need building it by C++ compiler.
      
      Function `tnt_strptime` uses assert, that triggered by fuzzing tests.
      Therefore it was replaced with to if..then.
      
      1. https://storage.googleapis.com/oss-fuzz-introspector/tarantool/
      
      Fixes #8490
      
      NO_CHANGELOG=fuzzing test
      NO_DOC=fuzzing test
      NO_TEST=fuzzing test
      
      (cherry picked from commit a1bd6e0b)
      9304de91
    • Timur Safin's avatar
      datetime: fix buffer overflow in tnt_strptime · cbc92fe8
      Timur Safin authored
      Fixes #8502
      Needed for #8490
      
      NO_DOC=bugfix
      NO_TEST=covered by fuzzing test
      
      (cherry picked from commit 783a7040)
      cbc92fe8
    • Dmitriy Nesterov's avatar
      test/fuzz: add grammar-based LuaJIT fuzzer · 23d56ddf
      Dmitriy Nesterov authored
      Patch adds a LuaJIT fuzzer based on libprotobuf-mutator and LibFuzzer.
      Grammar is described via messages in protobuf format, serializer is
      applied to convert .proto format to string.
      
      For displaying generated code on the screen during fuzzing set
      the environment variable 'LPM_DUMP_NATIVE_INPUT'.
      
      For displaying error messages from lua functions set
      the environment variable 'LUA_FUZZER_VERBOSE'.
      
      Note: UndefinedBehaviourSanitizer is unsupported by LuaJIT (see #8473),
      so fuzzing test is disabled when CMake option ENABLE_UB_SANITIZER is
      passed.
      
      Closes #4823
      
      NO_DOC=<fuzzing testing of LuaJIT>
      NO_TEST=<fuzzing testing of LuaJIT>
      
      (cherry picked from commit a287c853)
      23d56ddf
    • Dmitriy Nesterov's avatar
      cmake: add dependencies for LuaJIT and SQL fuzzers · 07ee9a4f
      Dmitriy Nesterov authored
      Added Google's 'libprotobuf-mutator' and 'protobuf' libraries
      for developing grammar-based LuaJIT and SQL fuzzers based on
      LibFuzzer.
      
      It is needed to build protobuf module from source because
      by default, the system-installed version of protobuf is used
      by libprotobuf-mutator, and this version can be too old.
      
      Part of #4823
      
      NO_CHANGELOG=<dependencies>
      NO_DOC=<dependencies>
      NO_TEST=<dependencies>
      
      (cherry picked from commit b11072a6)
      07ee9a4f
    • Dmitriy Nesterov's avatar
      test/fuzz: add options for better fuzzing · 481d7c7a
      Dmitriy Nesterov authored
      Added options for fuzzing and for getting more information
      on debugging.
      
      NO_CHANGELOG=<fuzzing options>
      NO_DOC=<fuzzing options>
      NO_TEST=<fuzzing options>
      
      (cherry picked from commit 69f21e25)
      481d7c7a
    • Vladimir Davydov's avatar
      vinyl: fix use-after-free in vy_read_iterator_next · 0a7d6e7f
      Vladimir Davydov authored
      A read source iterator stores statements in a vy_history object using
      vy_history_append_stmt(). If a statement can be referenced, it's
      reference counter is incremented. If it can't, i.e. it belongs to a
      memory source, it's stored in a vy_history object without referencing.
      
      This works fine because memory sources are append-only. A problem arises
      only when we get to scanning disk sources. Since we yield while reading
      disk, a dump task may complete concurrently dropping the memory sources
      and possibly invalidating statements stored in the iterator history.
      Although we drop the history accumulated so far and restart the
      iteration from scratch in this case, there's still an issue that can
      result in a use-after-free bug in vy_read_iterator_next().
      
      The problem is that we access the current candidate for the next
      statement while evaluating a disk source after a disk read. If 'next'
      refers to a referenced statement, it's fine, but if it refers to a
      statement from a memory source, it may cause use-after-free because
      the memory source may be dropped during a disk read.
      
      To fix this issue, let's make vy_history_append_stmt() copy statements
      coming from memory sources. This should be fine performance-wise because
      we copied memory statements eventually in vy_history_apply() anyway,
      before returning them to the user.
      
      Note that we also have to update vy_read_iterator_restore_mem() because
      it implicitly relied on the fact that 'next' coming from a memory source
      can't be freed by vy_mem_iterator_restore(), which cleans up the memory
      source history. Now, it isn't true anymore so we have to temporarily
      take a reference to 'next' explicitly.
      
      Closes #8852
      
      NO_DOC=bug fix
      NO_TEST=tested by ASAN
      
      (cherry picked from commit 0e5a3cc2)
      0a7d6e7f
    • Igor Munkin's avatar
      cmake: introduce FIBER_STACK_SIZE option · a6a52d1b
      Igor Munkin authored
      In scope of the commit 82f4b4a3 ("lib/core/fiber: Increase default
      stack size") the default value of fiber stack size is increased up to
      512 Kb (you can find the reasons in the aforementioned commit message
      and in https://github.com/tarantool/tarantool/issues/3418 description).
      
      Some of the tests in test/PUC-Rio-Lua-5.1-test suite in LuaJIT repo
      (e.g. some cases with deep recursion in errors.lua or pm.lua) have
      already been tweaked according to the limitations mentioned in
      https://github.com/tarantool/tarantool/issues/5782, but the crashes
      still occurs while running LuaJIT tests with ASan support enabled.
      
      To make the testing routine more convenient, FIBER_STACK_SIZE option is
      introduced to Tarantool CMake machinery. One can provide the size either
      by raw digits (i.e. in bytes) or using Kb/Mb suffixes for convenience.
      
      A couple of important nits:
      * If the given value is not a multiple of 4Kb, CMake machinery adjusts
        it up to the nearest one greater than this value.
      * If the adjusted value is less than 512Kb, configuration fails with the
        corresponding CMake fatal error.
      
      Follows up #3418
      Relates to #5782
      
      @TarantoolBot document
      Title: introduce FIBER_STACK_SIZE configuration option
      
      To make managing of the default fiber stack size more convenient, the
      corresponding CMake option is added.
      
      **NB**: The stack size can't be less than 512Kb and if the given value
      is not a multiple of 4Kb, CMake machinery adjusts it up to the nearest
      one greater than this value.
      
      (cherry picked from commit ff57f990)
      a6a52d1b
    • Gleb Kashkin's avatar
      compat: fix err msg in compat.<option>:is_new() · 546e63d3
      Gleb Kashkin authored
      In the original commit 5f6d367c ("compat: add is_new and
      is_old to options") `compat.<option_name>:is_new()` and `:is_old()`
      were introduced, but by mistake they contained different usage
      messages. This patch updates `:is_new()` usage msg to more
      informative one from `:is_old()`.
      
      Follows up #8807
      
      NO_CHANGELOG=changelog from 5f6d367c is valid
      NO_DOC=doc from 5f6d367c is valid
      
      (cherry picked from commit f590ec22)
      546e63d3
    • Gleb Kashkin's avatar
      compat: add is_new and is_old to options · 05eb81e2
      Gleb Kashkin authored
      It used to be somewhat complicated to check the effective value
      of a compat option, because `<option_name>.current` could contain
      'default' state.
      This patch introduces helper functions that take care of that.
      
      The following alternatives were considered:
      * `compat.<option_name>.effective` - it is excessive in the presence
        if `current` and `default`, and is visible in serialization
      * `compat.<option_name>.get()` - while it is a function, it does only
        half of the work required, user still has to compare result to 'new'
      
      Closes #8807
      
      @TarantoolBot document
      Title: Add `:is_new/old()` helpers to tarantool.compat options
      
      `compat.<option_name>.current` can be 'new', 'old' or 'default',
      thus when it is default there must be an additional check if
      `compat.<option_name>.default` is 'new'. It is handier to have a
      helper to deal with that instead of complicated `if`:
      * check if effective value is 'new' before the patch:
        ```lua
        if compat.<option_name>.current == 'new' or
                (compat.<option_name>.current == 'default' and
                 compat.<option_name>.default == 'new') then
            ...
        end
        ```
      * after the patch:
        ```lua
        if compat.<option_name>:is_new() then
            ...
        end
        ```
      
      Please update [tutorial on using compat], maybe add an example to
      [Listing options details].
      
      [tutorial on using compat]: https://www.tarantool.io/en/doc/latest/reference/reference_lua/compat/compat_tutorial/
      [Listing options details]: https://www.tarantool.io/en/doc/latest/reference/reference_lua/compat/compat_tutorial/#listing-options-details
      
      (cherry picked from commit 5f6d367c)
      05eb81e2
Loading