Skip to content
Snippets Groups Projects
  1. Dec 22, 2023
    • Rimma Tolkacheva's avatar
      test/fuzz: refactor LuaJIT fuzzer · 6245ced1
      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)
      (cherry picked from commit 8ebe4851)
      6245ced1
    • klauwier's avatar
      test/fuzz: fix luaJIT fuzzer timeout · 9ea3a169
      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)
      (cherry picked from commit 9c59bbc8)
      9ea3a169
    • klauwier's avatar
      test/fuzz: add breaks to switch-case · 0519f51f
      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)
      (cherry picked from commit 61f7892e)
      0519f51f
    • Sergey Bronnikov's avatar
      test/fuzz: fix datetime_strptime fuzzing test · 3d339ab6
      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)
      (cherry picked from commit 504a0f88)
      3d339ab6
    • Timur Safin's avatar
      datetime: fix buffer overflow in tnt_strptime · e9eff582
      Timur Safin authored
      Fixes #8502
      Needed for #8490
      
      NO_DOC=bugfix
      NO_TEST=covered by fuzzing test
      
      (cherry picked from commit 783a7040)
      (cherry picked from commit 70b0fc1f)
      e9eff582
    • Dmitriy Nesterov's avatar
      test/fuzz: add grammar-based LuaJIT fuzzer · d2bc56cb
      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)
      (cherry picked from commit 87f4c930)
      d2bc56cb
    • Dmitriy Nesterov's avatar
      cmake: add dependencies for LuaJIT and SQL fuzzers · d1a601f1
      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)
      (cherry picked from commit 70469594)
      d1a601f1
    • Dmitriy Nesterov's avatar
      test/fuzz: add options for better fuzzing · 82bedc6c
      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)
      (cherry picked from commit 85496d4a)
      82bedc6c
    • Sergey Bronnikov's avatar
      test: fix format of dictionaries · 77c90294
      Sergey Bronnikov authored
      According to libFuzzer documentation [1] backslash should be escaped.
      
      1. https://llvm.org/docs/LibFuzzer.html#dictionaries
      
      ```
      $ swim_proto_meta_fuzzer -dict=swim_proto_meta_fuzzer.dict
      ParseDictionaryFile: error in line 1
                      "\001\000\000\004"
      $ swim_proto_member_fuzzer -dict=swim_proto_member_fuzzer.dict
      ParseDictionaryFile: error in line 1
                      "\022\000\000\000\000\000\000\000"
      ```
      
      NO_CHANGELOG=internal
      NO_DOC=internal
      NO_TEST=internal
      
      (cherry picked from commit 62d03f15)
      (cherry picked from commit 2b3eeda5)
      77c90294
    • Sergey Bronnikov's avatar
      test/static: add dictionary for swim_proto_meta_fuzzer · 1ec10df0
      Sergey Bronnikov authored
      Follows up #8488
      
      NO_CHANGELOG=testing
      NO_DOC=testing
      NO_TEST=testing
      
      (cherry picked from commit 64427eec)
      (cherry picked from commit 787953b7)
      1ec10df0
    • Sergey Bronnikov's avatar
      test/static: add dictionary for swim_proto_member_fuzzer · e3fe4cf5
      Sergey Bronnikov authored
      Follows up #8488
      
      NO_CHANGELOG=testing
      NO_DOC=testing
      NO_TEST=testing
      
      (cherry picked from commit 1e584e89)
      (cherry picked from commit d7f0a14b)
      e3fe4cf5
    • Sergey Bronnikov's avatar
      test/static: add seed corpus and dictionary for datetime_parse_full · 66f033fd
      Sergey Bronnikov authored
      Seed corpus based on test data used in regression tests.
      Dictionary was created using fuzzing test after 10^6 test executions.
      
      Follows up #6731
      Fixes #8488
      
      NO_CHANGELOG=fuzzing corpus
      NO_DOC=fuzzing corpus
      NO_TEST=fuzzing corpus
      
      (cherry picked from commit 46725004)
      (cherry picked from commit af974bff)
      66f033fd
    • Sergey Bronnikov's avatar
      test/static: add seed corpus and dictionary for datetime_strptime · a9b056de
      Sergey Bronnikov authored
      Seed corpus based on test data used in regression tests.
      Dictionary was created using fuzzing test after 10^6 test executions.
      
      Follows up #6731
      Part of #8488
      
      NO_CHANGELOG=fuzzing corpus
      NO_DOC=fuzzing corpus
      NO_TEST=fuzzing corpus
      
      (cherry picked from commit b0b11131)
      (cherry picked from commit df31b8ca)
      a9b056de
  2. Dec 20, 2023
  3. Nov 16, 2023
  4. Nov 15, 2023
  5. Nov 07, 2023
    • godzie44's avatar
      Part of #37 · 0c8a7484
      godzie44 authored and Konstantin D's avatar Konstantin D committed
      Add `current_cord_name` function to get a name of the current cord,
      add `cord_is_main_dont_create` function.
      Add exports for `cord_is_main`, `cord_is_main_dont_create` and
      `current_cord_name` functions.
      
      NO_DOC=internal
      NO_TEST=internal
      NO_CHANGELOG=internal
    • godzie44's avatar
      Part of #37 · f980791e
      godzie44 authored and Konstantin D's avatar Konstantin D committed
      Add `log_default_logger` to get a default logger.
      Add exports for `log_set_format`, `log_set_level` and `log_default_logger` functions.
      
      NO_DOC=internal
      NO_TEST=internal
      NO_CHANGELOG=internal
      f980791e
  6. Nov 01, 2023
  7. Oct 30, 2023
  8. Oct 27, 2023
    • Georgy Moshkin's avatar
      fiber: basic api exports · 7b6484de
      Georgy Moshkin authored
      Closes #9237
      
      Add exports for fiber_set_name_n, fiber_name, fiber_id, fiber_csw &
      fiber_find.
      
      Also make fiber_set_joinable, fiber_set_ctx & fiber_get_ctx interpret
      NULL as the current fiber.
      
      @TarantoolBot document
      Title: add basic fiber api to ffi exports.
      
      5 basic functions can now be used via ffi api, which were previously
      only accessible via lua api: fiber_set_name_n, fiber_name, fiber_id,
      fiber_csw & fiber_find.
      
      fiber_set_joinable now interprets NULL as current fiber.
  9. Oct 19, 2023
Loading