Skip to content

Commit

Permalink
POINSON
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Feb 13, 2024
1 parent b8809c3 commit c08edd8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/code_sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ jobs:
BACKEND: [ lmdb, rocksdb ]
COMPILER: [ clang ]
SANITIZER:
- { name: UBSAN, ignore_errors: false }
# - { name: UBSAN, ignore_errors: false }
- { name: ASAN, ignore_errors: true }
- { name: TSAN, ignore_errors: true }
# - { name: TSAN, ignore_errors: true }
runs-on: macos-14
env:
COMPILER: ${{ matrix.COMPILER }}
Expand All @@ -80,9 +80,9 @@ jobs:
IGNORE_ERRORS: ${{ matrix.SANITIZER.ignore_errors }}
TEST_USE_ROCKSDB: ${{ matrix.BACKEND == 'rocksdb' && '1' || '0' }}
DEADLINE_SCALE_FACTOR: ${{ matrix.BACKEND == 'rocksdb' && '2' || '1' }}
ASAN_OPTIONS: log_exe_name=1:log_path=sanitizer_report:suppressions=../asan_suppressions
TSAN_OPTIONS: log_exe_name=1:log_path=sanitizer_report:suppressions=../tsan_suppressions
UBSAN_OPTIONS: log_exe_name=1:log_path=sanitizer_report:print_stacktrace=1
# ASAN_OPTIONS: log_exe_name=1:log_path=sanitizer_report:suppressions=../asan_suppressions
# TSAN_OPTIONS: log_exe_name=1:log_path=sanitizer_report:suppressions=../tsan_suppressions
# UBSAN_OPTIONS: log_exe_name=1:log_path=sanitizer_report:print_stacktrace=1
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout
Expand All @@ -102,6 +102,8 @@ jobs:
continue-on-error: true
run: timeout -sKILL 45m ../ci/tests/run-core-tests.sh
working-directory: build
env:
GTEST_FLAGS: --gtest_repeat=1000

- name: RPC Tests
if: steps.build.outcome == 'success' && (success() || failure())
Expand Down
2 changes: 1 addition & 1 deletion ci/tests/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ esac

# Run the test
executable=./${target}$(get_exec_extension)
"${executable}"
"${executable}" "${GTEST_FLAGS-}"
status=$?

if [ $status -ne 0 ]; then
Expand Down
7 changes: 6 additions & 1 deletion nano/node/transport/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@

#include <magic_enum.hpp>

#include <sanitizer/asan_interface.h>

/*
* socket
*/

nano::transport::socket::socket (nano::node & node_a, endpoint_type_t endpoint_type_a, std::size_t max_queue_size_a) :
send_queue{ max_queue_size_a },
strand{ node_a.io_ctx.get_executor () },
tcp_socket{ node_a.io_ctx },
tcp_socket_ptr{ std::make_unique<boost::asio::ip::tcp::socket> (node_a.io_ctx) },
tcp_socket{ *tcp_socket_ptr },
node{ node_a },
endpoint_type_m{ endpoint_type_a },
timeout{ std::numeric_limits<uint64_t>::max () },
Expand All @@ -32,6 +35,8 @@ nano::transport::socket::socket (nano::node & node_a, endpoint_type_t endpoint_t
silent_connection_tolerance_time{ node_a.network_params.network.silent_connection_tolerance_time },
max_queue_size{ max_queue_size_a }
{
__asan_poison_memory_region (poison1.data (), poison1.size ());
__asan_poison_memory_region (poison2.data (), poison2.size ());
}

nano::transport::socket::~socket ()
Expand Down
7 changes: 6 additions & 1 deletion nano/node/transport/socket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,12 @@ class socket final : public std::enable_shared_from_this<nano::transport::socket

protected:
boost::asio::strand<boost::asio::io_context::executor_type> strand;
boost::asio::ip::tcp::socket tcp_socket;

std::array<uint8_t, 8> poison1;
std::unique_ptr<boost::asio::ip::tcp::socket> tcp_socket_ptr;
boost::asio::ip::tcp::socket & tcp_socket;
std::array<uint8_t, 8> poison2;

nano::node & node;

/** The other end of the connection */
Expand Down

0 comments on commit c08edd8

Please sign in to comment.