Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ option(DF_USE_SSL "Provide support for SSL connections" ON)

find_package(OpenSSL)

SET(SANITIZERS OFF)

# AFL++ configuration - must be before sanitizer checks
if(USE_AFL)
message(STATUS "AFL++ fuzzing mode active")
Expand Down Expand Up @@ -91,18 +89,12 @@ option(WITH_ASAN "Enable -fsanitize=address" OFF)
if (SUPPORT_ASAN AND WITH_ASAN)
message(STATUS "address sanitizer enabled")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address")
set(SANITIZERS ON)
endif()

option(WITH_USAN "Enable -fsanitize=undefined" OFF)
if (SUPPORT_USAN AND WITH_USAN)
message(STATUS "ub sanitizer enabled")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=undefined")
set(SANITIZERS ON)
endif()

if(SANITIZERS)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
endif()

include(third_party)
Expand Down
16 changes: 0 additions & 16 deletions src/server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ if (PRINT_STACKTRACES_ON_SIGNAL)
target_compile_definitions(dragonfly_lib PRIVATE PRINT_STACKTRACES_ON_SIGNAL)
endif()

if (WITH_ASAN OR WITH_USAN)
target_compile_definitions(dfly_transaction PRIVATE SANITIZERS)
endif()

if (WITH_AWS)
SET(AWS_LIB awsv2_lib)
add_definitions(-DWITH_AWS)
Expand All @@ -132,10 +128,6 @@ endif()
add_library(dfly_test_lib test_utils.cc)
cxx_link(dfly_test_lib dragonfly_lib facade_test gtest_main_ext)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With SANITIZERS no longer defined for dfly_test_lib, src/server/test_utils.cc will not take its #elif defined SANITIZERS branch (larger fiber stack under sanitizers). This may reduce the default stack size under ASAN/UBSAN and lead to stack overflows or test flakiness.

🤖 Was this useful? React with 👍 or 👎

if (WITH_ASAN OR WITH_USAN)
target_compile_definitions(dfly_test_lib PRIVATE SANITIZERS)
endif()

cxx_test(dragonfly_test dfly_test_lib LABELS DFLY)
cxx_test(multi_test dfly_test_lib LABELS DFLY)
cxx_test(generic_family_test dfly_test_lib LABELS DFLY)
Expand All @@ -162,14 +154,6 @@ cxx_test(cluster/cluster_config_test dfly_test_lib LABELS DFLY)
cxx_test(cluster/cluster_family_test dfly_test_lib LABELS DFLY)
cxx_test(acl/acl_family_test dfly_test_lib LABELS DFLY)
cxx_test(engine_shard_set_test dfly_test_lib LABELS DFLY)
if (WITH_ASAN OR WITH_USAN)
target_compile_definitions(stream_family_test PRIVATE SANITIZERS)
target_compile_definitions(multi_test PRIVATE SANITIZERS)
target_compile_definitions(search_family_test PRIVATE SANITIZERS)
target_compile_definitions(json_family_test PRIVATE SANITIZERS)
target_compile_definitions(json_family_memory_test PRIVATE SANITIZERS)
target_compile_definitions(dragonfly_test PRIVATE SANITIZERS)
endif()

add_dependencies(check_dfly dragonfly_test json_family_test list_family_test
generic_family_test memcache_parser_test rdb_test journal_test
Expand Down
3 changes: 0 additions & 3 deletions src/server/dragonfly_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,6 @@ TEST_F(DflyEngineTest, OOM) {
}
}

#ifndef SANITIZERS
/// Reproduces the case where items with expiry data were evicted,
/// and then written with the same key.
TEST_F(DflyEngineTest, Bug207) {
Expand Down Expand Up @@ -561,8 +560,6 @@ TEST_F(DflyEngineTest, StickyEviction) {
}
}

#endif

TEST_F(DflyEngineTest, ZeroAllocationEviction) {
max_memory_limit = 500000; // 0.5mb
shard_set->TEST_EnableCacheMode();
Expand Down
2 changes: 0 additions & 2 deletions src/server/json_family_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2567,10 +2567,8 @@ TEST_F(JsonFamilyTest, MGet) {
resp = Run({"JSON.SET", "json2", ".", json[1]});
ASSERT_THAT(resp, "OK");

#ifndef SANITIZERS
resp = Run({"JSON.MGET", "json1", "??INNNNVALID??"});
EXPECT_THAT(resp, ErrArg("ERR syntax error"));
#endif

resp = Run({"JSON.MGET", "json1", "json2", "json3", "$.address.country"});
ASSERT_EQ(RespExpr::ARRAY, resp.type);
Expand Down
7 changes: 0 additions & 7 deletions src/server/multi_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ TEST_F(MultiTest, FlushDb) {
// Triggers a false possitive and therefore we turn it off
// There seem not to be a good solution to handle these false positives
// since sanitizers work well with u_context which is *very* slow
#ifndef SANITIZERS
TEST_F(MultiTest, Eval) {
if (auto config = absl::GetFlag(FLAGS_default_lua_flags); config != "") {
GTEST_SKIP() << "Skipped Eval test because default_lua_flags is set";
Expand Down Expand Up @@ -555,7 +554,6 @@ TEST_F(MultiTest, Eval) {
EXPECT_EQ(resp.GetVec()[0], "0");
EXPECT_EQ(resp.GetVec()[1].type, RespExpr::Type::ARRAY);
}
#endif

TEST_F(MultiTest, Watch) {
auto kExecFail = ArgType(RespExpr::NIL);
Expand Down Expand Up @@ -784,7 +782,6 @@ TEST_F(MultiTest, ExecGlobalFallback) {
EXPECT_EQ(1, GetMetrics().coordinator_stats.tx_global_cnt);
}

#ifndef SANITIZERS
TEST_F(MultiTest, ScriptFlagsCommand) {
if (auto flags = absl::GetFlag(FLAGS_default_lua_flags); flags != "") {
GTEST_SKIP() << "Skipped ScriptFlagsCommand test because default_lua_flags is set";
Expand Down Expand Up @@ -820,7 +817,6 @@ TEST_F(MultiTest, ScriptFlagsCommand) {
EXPECT_THAT(Run({"eval", kUndeclared2, "0"}), "works");
}
}
#endif

TEST_F(MultiTest, ScriptFlagsEmbedded) {
const char* s1 = R"(
Expand Down Expand Up @@ -1200,8 +1196,6 @@ TEST_F(MultiEvalTest, MultiSomeEval) {
EXPECT_THAT(brpop_resp, ArgType(RespExpr::NIL_ARRAY));
}

// Flaky because of https://github.com/google/sanitizers/issues/1760
#ifndef SANITIZERS
TEST_F(MultiEvalTest, ScriptSquashingUknownCmd) {
absl::FlagSaver fs;
absl::SetFlag(&FLAGS_lua_auto_async, true);
Expand All @@ -1220,7 +1214,6 @@ TEST_F(MultiEvalTest, ScriptSquashingUknownCmd) {
EXPECT_THAT(Run({"EVAL", s, "1", "A"}), ErrArg("unknown command `SECOND WRONG`"));
EXPECT_EQ(Run({"get", "A"}), "2");
}
#endif

TEST_F(MultiEvalTest, MultiAndEval) {
// We had a bug in borrowing interpreters which caused a crash in this scenario
Expand Down
11 changes: 0 additions & 11 deletions src/server/search/search_family_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,6 @@ TEST_F(SearchFamilyTest, Stats) {
EXPECT_LE(metrics.search_stats.used_memory, 3 * expected_usage);
}

// todo: ASAN fails heres on arm
#ifndef SANITIZERS
TEST_F(SearchFamilyTest, Simple) {
Run({"hset", "d:1", "foo", "baz", "k", "v"});
Run({"hset", "d:2", "foo", "bar", "k", "v"});
Expand All @@ -346,7 +344,6 @@ TEST_F(SearchFamilyTest, Simple) {
Run({"hset", "w:2", "foo", "this", "k", "v"});
EXPECT_THAT(Run({"ft.search", "i1", "@foo:this"}), kNoResults);
}
#endif

TEST_F(SearchFamilyTest, Errors) {
Run({"ft.create", "i1", "PREFIX", "1", "d:", "SCHEMA", "foo", "TAG", "bar", "TEXT"});
Expand Down Expand Up @@ -419,8 +416,6 @@ TEST_F(SearchFamilyTest, JsonIdentifierWithBrackets) {
EXPECT_THAT(Run({"ft.search", "i1", "(@continent:{Europe})"}), AreDocIds("k1", "k2"));
}

// todo: fails on arm build
#ifndef SANITIZERS
TEST_F(SearchFamilyTest, JsonArrayValues) {
string_view D1 = R"(
{
Expand Down Expand Up @@ -495,7 +490,6 @@ TEST_F(SearchFamilyTest, JsonArrayValues) {
res = Run({"ft.search", "i1", "@name:alex", "return", "1", "::??INVALID??::", "as", "retval"});
EXPECT_THAT(res, IsMapWithSize("k1", IsMap()));
}
#endif

TEST_F(SearchFamilyTest, Tags) {
Run({"hset", "d:1", "color", "red, green"});
Expand Down Expand Up @@ -963,7 +957,6 @@ TEST_F(SearchFamilyTest, FtProfile) {
ASSERT_ARRAY_OF_TWO_ARRAYS(resp);
}

#ifndef SANITIZERS
TEST_F(SearchFamilyTest, FtProfileInvalidQuery) {
Run({"json.set", "j1", ".", R"({"id":"1"})"});
Run({"ft.create", "i1", "on", "json", "schema", "$.id", "as", "id", "tag"});
Expand All @@ -976,7 +969,6 @@ TEST_F(SearchFamilyTest, FtProfileInvalidQuery) {
resp = Run({"ft.profile", "i1", "search", "query", "@{invalid13289}"});
EXPECT_THAT(resp, ErrArg("query syntax error"));
}
#endif

TEST_F(SearchFamilyTest, FtProfileErrorReply) {
Run({"ft.create", "i1", "schema", "name", "text"});
Expand Down Expand Up @@ -1286,8 +1278,6 @@ TEST_F(SearchFamilyTest, FlushSearchIndices) {
EXPECT_THAT(resp, ErrArg("ERR Index already exists"));
}

// todo: ASAN fails heres on arm
#ifndef SANITIZERS
TEST_F(SearchFamilyTest, AggregateWithLoadOptionHard) {
// Test HASH
Run({"HSET", "h1", "word", "item1", "foo", "10", "text", "first key"});
Expand Down Expand Up @@ -1327,7 +1317,6 @@ TEST_F(SearchFamilyTest, AggregateWithLoadOptionHard) {
EXPECT_THAT(resp, IsUnordArrayWithSize(IsMap("foo_total", "20", "word", "item2"),
IsMap("foo_total", "10", "word", "item1")));
}
#endif

TEST_F(SearchFamilyTest, WrongFieldTypeJson) {
// Test simple
Expand Down
2 changes: 1 addition & 1 deletion src/server/server_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ void ServerState::DecommitMemory(uint8_t flags) {
#ifdef __GLIBC__
// There is an issue with malloc_trim and sanitizers because the asan replace malloc but is not
// aware of malloc_trim which causes malloc_trim to segfault because it's not initialized properly
#ifndef SANITIZERS
#ifndef ABSL_HAVE_ADDRESS_SANITIZER
malloc_trim(0);
#endif
#endif
Expand Down
3 changes: 0 additions & 3 deletions src/server/stream_family_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -504,16 +504,13 @@ TEST_F(StreamFamilyTest, XReadGroupEmpty) {
EXPECT_THAT(resp, ArrLen(2));
}

// todo: ASAN fails heres on arm
#ifndef SANITIZERS
TEST_F(StreamFamilyTest, Issue854) {
auto resp = Run({"xgroup", "help"});
EXPECT_THAT(resp, ArgType(RespExpr::ARRAY));

resp = Run({"eval", "redis.call('xgroup', 'help')", "0"});
EXPECT_THAT(resp, ErrArg("is not allowed"));
}
#endif

TEST_F(StreamFamilyTest, XGroupConsumer) {
Run({"xgroup", "create", "foo", "group", "$", "MKSTREAM"});
Expand Down
Loading