Skip to content

Commit

Permalink
Add suppressions for Rijndael::Base::FillEncTable and Rijndael::Base:…
Browse files Browse the repository at this point in the history
…:FillDecTable. There is a race condition when initializing these tables but since their contents is static, the fields will always have the correct, constant values.
  • Loading branch information
clemahieu committed Nov 22, 2021
1 parent 5a274cd commit 5d369dd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions nano/core_test/uint256_union.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#include <nano/crypto_lib/random_pool.hpp>
#include <nano/secure/common.hpp>
#include <nano/test_common/testutil.hpp>

#include <gtest/gtest.h>

#include <thread>

namespace
{
template <typename Union, typename Bound>
Expand Down Expand Up @@ -567,3 +570,19 @@ void check_operator_greater_than (Num lhs, Num rhs)
ASSERT_FALSE (rhs > rhs);
}
}

TEST (random_pool, multithreading)
{
std::vector<std::thread> threads;
for (auto i = 0; i < 100; ++i)
{
threads.emplace_back ([] () {
nano::uint256_union number;
nano::random_pool::generate_block (number.bytes.data (), number.bytes.size ());
});
}
for (auto & i : threads)
{
i.join ();
}
}
2 changes: 2 additions & 0 deletions tsan_suppressions
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
race:mdb.c
race:rocksdb
race:Rijndael::Base::FillEncTable
race:Rijndael::Base::FillDecTable

0 comments on commit 5d369dd

Please sign in to comment.