{"id":16659104,"url":"https://github.com/agroce/testleveldb","last_synced_at":"2025-04-09T18:41:36.899Z","repository":{"id":90292761,"uuid":"164339272","full_name":"agroce/testleveldb","owner":"agroce","description":"DeepState testing for levelDB","archived":false,"fork":false,"pushed_at":"2019-06-05T22:46:29.000Z","size":35,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T20:43:26.975Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agroce.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-06T19:38:45.000Z","updated_at":"2020-04-01T06:11:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"5bfc770e-dcf3-4ea5-8ff1-4c3ba49603cd","html_url":"https://github.com/agroce/testleveldb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agroce%2Ftestleveldb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agroce%2Ftestleveldb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agroce%2Ftestleveldb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agroce%2Ftestleveldb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agroce","download_url":"https://codeload.github.com/agroce/testleveldb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248089929,"owners_count":21045992,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T10:23:49.517Z","updated_at":"2025-04-09T18:41:36.891Z","avatar_url":"https://github.com/agroce.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Differential fuzzing for leveldb and rocksdb.\n\nOne way to go about things right now (until background threads in\nrocksdb are handled) is to use AFL, fuzz leveldb, then run the tests\non the two databases together.  This is pretty simple, just\n\n\n1.  install [DeepState](https://github.com/trailofbits/deepstate).  The easiest way to do this is probably the [DeepState docker](https://github.com/trailofbits/deepstate#DOCKER).\n\n2.  build both databases using afl-clang as your compiler, to get\n    instrumentation (in fact, for now, you can skip this for RocksDB,\n    just build it)\n\n3. build the fuzzers, and fuzz leveldb like, e.g., this:\n\n```\n~/afl/afl-fuzz -i \u003csometest\u003e -o \u003coutput_dir\u003e -- ./TestLevelDB --input_test_file @@ --exit_on_fail\n```\n\nYou can also go for libFuzzer based testing:\n\n1.  install [DeepState](https://github.com/trailofbits/deepstate) with BUILD_LIBFUZZER=TRUE\n\n2.  install leveldb, after editing its CMakeLists.txt to add -fsanitize=integer,undefined,address,fuzzer-no-link\n\nediting the CMakeLists.txt thus:\n\n```\n@@ -40,6 +40,7 @@ include(CheckCXXSourceCompiles)\n # -Werror is necessary because unknown attributes only generate warnings.\n set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})\n list(APPEND CMAKE_REQUIRED_FLAGS -Werror -Wthread-safety)\n+list(APPEND CMAKE_REQUIRED_FLAGS -fsanitize=fuzzer-no-link,integer,address,undefined)\n check_cxx_source_compiles(\"\n struct __attribute__((lockable)) Lock {\n void Acquire() __attribute__((exclusive_lock_function()));\n ```\n may work\n\nMake sure to use a clang \u003e= 6.0 to compile!\n\n3. install rocksdb, after editing its Makefile to add\n-fsanitize=integer,undefined,address,fuzzer-no-link:\n\n```\n@@ -232,6 +232,11 @@ ifneq ($(filter -DROCKSDB_LITE,$(OPT)),)\n        LUA_PATH =\n endif\n \n+DISABLE_JEMALLOC=1\n+EXEC_LDFLAGS += -fsanitize=address,integer,undefined,fuzzer-no-link\n+PLATFORM_CCFLAGS += -fsanitize=address,integer,undefined,fuzzer-no-link\n+PLATFORM_CXXFLAGS += -fsanitize=address,integer,undefined,fuzzer-no-link\n+\n # ASAN doesn't work well with jemalloc. If we're compiling with ASAN, we should use regular malloc.\n ifdef COMPILE_WITH_ASAN\n        DISABLE_JEMALLOC=1\n```\n\nMake sure to use a clang \u003e= 6.0 to compile!\n\n4.  edit this repo's Makefile to link to `deepstate_LF` or `deepstate_AFL` to build libfuzzer/afl fuzzers.\n\nUsing a ramdisk for the databases is *STRONGLY* recommended, unless\nyou want to both fuzz slowly and burn out your SSD.\n\n5.  `make`\n\n`DiffTestDBs` and `DiffTestDBs_LF` are the primary fuzzers.  `TestLevelDB`\njust runs leveldb, without differential testing with RocksDB.  Tests from `TestLevelDB` run in `DiffTestDBs`.  If you have trouble building the databases with instrumentation, in fact, you can just build them exactly as you normally would for release, and then use Eclipser to fuzz TestLevelDB.  Unfortunately, some issue currently prevents Eclipser from fuzzing rocksdb.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagroce%2Ftestleveldb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagroce%2Ftestleveldb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagroce%2Ftestleveldb/lists"}