more code changes

Signed-off-by: Pratik Mankawde <pratikmankawde@gmail.com>
This commit is contained in:
Pratik Mankawde
2025-11-26 15:13:12 +00:00
parent 6202148623
commit 064d51b79c
9 changed files with 25 additions and 28 deletions

View File

@@ -208,7 +208,7 @@ def addSanitizerConfigs(architecture: dict, os: dict, build_type: str, cmake_arg
# before CMake processes it. This ensures the compiler receives an absolute path. # before CMake processes it. This ensures the compiler receives an absolute path.
# CMAKE_SOURCE_DIR won't work here because it's inside CMAKE_CXX_FLAGS string. # CMAKE_SOURCE_DIR won't work here because it's inside CMAKE_CXX_FLAGS string.
# GCC doesn't support ignorelist. # GCC doesn't support ignorelist.
cxx_flags += ' -fsanitize-ignorelist=$GITHUB_WORKSPACE/external/sanitizer-ignorelist.txt' cxx_flags += ' -fsanitize-ignorelist=$GITHUB_WORKSPACE/sanitizers/suppressions/sanitizer-ignorelist.txt'
sanitizers_flags = f'{sanitizers_flags},signed-integer-overflow,unsigned-integer-overflow' sanitizers_flags = f'{sanitizers_flags},signed-integer-overflow,unsigned-integer-overflow'
linker_flags += f' -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address,{sanitizers_flags}"' linker_flags += f' -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address,{sanitizers_flags}"'
linker_flags += f' -DCMAKE_SHARED_LINKER_FLAGS="-fsanitize=address,{sanitizers_flags}"' linker_flags += f' -DCMAKE_SHARED_LINKER_FLAGS="-fsanitize=address,{sanitizers_flags}"'

View File

@@ -172,10 +172,10 @@ jobs:
BUILD_TYPE: ${{ inputs.build_type }} BUILD_TYPE: ${{ inputs.build_type }}
PARALLELISM: ${{ runner.os == 'Windows' && '1' || steps.nproc.outputs.nproc }} PARALLELISM: ${{ runner.os == 'Windows' && '1' || steps.nproc.outputs.nproc }}
run: | run: |
export ASAN_OPTIONS="detect_container_overflow=0 suppressions=$GITHUB_WORKSPACE/external/asan.supp" export ASAN_OPTIONS="detect_container_overflow=0 suppressions=$GITHUB_WORKSPACE/sanitizers/suppressions/asan.supp"
export TSAN_OPTIONS="second_deadlock_stack=1 halt_on_error=0 suppressions=$GITHUB_WORKSPACE/external/tsan.supp" export TSAN_OPTIONS="second_deadlock_stack=1 halt_on_error=0 suppressions=$GITHUB_WORKSPACE/sanitizers/suppressions/tsan.supp"
export UBSAN_OPTIONS="suppressions=$GITHUB_WORKSPACE/external/ubsan.supp" export UBSAN_OPTIONS="suppressions=$GITHUB_WORKSPACE/sanitizers/suppressions/ubsan.supp"
export LSAN_OPTIONS="suppressions=$GITHUB_WORKSPACE/external/lsan.supp" export LSAN_OPTIONS="suppressions=$GITHUB_WORKSPACE/sanitizers/suppressions/lsan.supp"
ctest \ ctest \
--output-on-failure \ --output-on-failure \
-C "${BUILD_TYPE}" \ -C "${BUILD_TYPE}" \
@@ -187,10 +187,10 @@ jobs:
env: env:
BUILD_NPROC: ${{ steps.nproc.outputs.nproc }} BUILD_NPROC: ${{ steps.nproc.outputs.nproc }}
run: | run: |
export ASAN_OPTIONS="detect_container_overflow=0 suppressions=$GITHUB_WORKSPACE/external/asan.supp" export ASAN_OPTIONS="detect_container_overflow=0 suppressions=$GITHUB_WORKSPACE/sanitizers/suppressions/asan.supp"
export TSAN_OPTIONS="second_deadlock_stack=1 halt_on_error=0 suppressions=$GITHUB_WORKSPACE/external/tsan.supp" export TSAN_OPTIONS="second_deadlock_stack=1 halt_on_error=0 suppressions=$GITHUB_WORKSPACE/sanitizers/suppressions/tsan.supp"
export UBSAN_OPTIONS="suppressions=$GITHUB_WORKSPACE/external/ubsan.supp" export UBSAN_OPTIONS="suppressions=$GITHUB_WORKSPACE/sanitizers/suppressions/ubsan.supp"
export LSAN_OPTIONS="suppressions=$GITHUB_WORKSPACE/external/lsan.supp" export LSAN_OPTIONS="suppressions=$GITHUB_WORKSPACE/sanitizers/suppressions/lsan.supp"
./rippled --unittest --unittest-jobs "${BUILD_NPROC}" ./rippled --unittest --unittest-jobs "${BUILD_NPROC}"
- name: Debug failure (Linux) - name: Debug failure (Linux)

View File

@@ -38,7 +38,4 @@ tools.build:exelinkflags+=['{{tsan_sanitizer_flags}}']
{% endif %} {% endif %}
{% if sanitizers == "Address" or sanitizers == "Thread" %} tools.info.package_id:confs+=["tools.build:cxxflags", "tools.build:exelinkflags", "tools.build:sharedlinkflags"]
user.package:sanitizers={{ sanitizers }}
tools.info.package_id:confs+=["user.package:sanitizers", "tools.build:cxxflags", "tools.build:exelinkflags", "tools.build:sharedlinkflags"]
{% endif %}

View File

@@ -1,7 +1,7 @@
# Sanitizer Configuration for Rippled # Sanitizer Configuration for Rippled
This document explains how to properly configure and run sanitizers (AddressSanitizer, UndefinedBehaviorSanitizer, ThreadSanitizer) with the rippled project. This document explains how to properly configure and run sanitizers (AddressSanitizer, UndefinedBehaviorSanitizer, ThreadSanitizer) with the rippled project.
Corresponding suppression files are located in the `external` directory. Corresponding suppression files are located in the `sanitizers/suppressions` directory.
- [Sanitizer Configuration for Rippled](#sanitizer-configuration-for-rippled) - [Sanitizer Configuration for Rippled](#sanitizer-configuration-for-rippled)
- [Building with Sanitizers](#building-with-sanitizers) - [Building with Sanitizers](#building-with-sanitizers)
@@ -12,11 +12,11 @@ Corresponding suppression files are located in the `external` directory.
- [ThreadSanitizer (TSan)](#threadsanitizer-tsan) - [ThreadSanitizer (TSan)](#threadsanitizer-tsan)
- [LeakSanitizer (LSan)](#leaksanitizer-lsan) - [LeakSanitizer (LSan)](#leaksanitizer-lsan)
- [Suppression Files](#suppression-files) - [Suppression Files](#suppression-files)
- [external/asan.supp](#externalasansupp) - [asan.supp](#asansupp)
- [external/lsan.supp](#externallsansupp) - [lsan.supp](#lsansupp)
- [external/ubsan.supp](#externalubsansupp) - [ubsan.supp](#ubsansupp)
- [external/tsan.supp](#externaltsansupp) - [tsan.supp](#tsansupp)
- [Ignorelist](#externalsanitizer-ignorelisttxt) - [Ignorelist](#sanitizer-ignorelisttxt)
- [Known False Positives](#known-false-positives) - [Known False Positives](#known-false-positives)
- [References](#references) - [References](#references)
@@ -112,7 +112,7 @@ export ASAN_OPTIONS="detect_leaks=0"
## Suppression Files ## Suppression Files
### `external/asan.supp` ### `asan.supp`
- **Purpose**: Suppress AddressSanitizer (ASan) errors only - **Purpose**: Suppress AddressSanitizer (ASan) errors only
- **Format**: `interceptor_name:<pattern>` where pattern matches file names. Supported suppression types are: - **Format**: `interceptor_name:<pattern>` where pattern matches file names. Supported suppression types are:
@@ -123,25 +123,25 @@ export ASAN_OPTIONS="detect_leaks=0"
- **More info**: [AddressSanitizer](https://github.com/google/sanitizers/wiki/AddressSanitizer) - **More info**: [AddressSanitizer](https://github.com/google/sanitizers/wiki/AddressSanitizer)
- **Note**: Cannot suppress stack-buffer-overflow, container-overflow, etc. - **Note**: Cannot suppress stack-buffer-overflow, container-overflow, etc.
### `external/lsan.supp` ### `lsan.supp`
- **Purpose**: Suppress LeakSanitizer (LSan) errors only - **Purpose**: Suppress LeakSanitizer (LSan) errors only
- **Format**: `leak:<pattern>` where pattern matches function/file names - **Format**: `leak:<pattern>` where pattern matches function/file names
- **More info**: [LeakSanitizer](https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer) - **More info**: [LeakSanitizer](https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer)
### `external/ubsan.supp` ### `ubsan.supp`
- **Purpose**: Suppress UndefinedBehaviorSanitizer errors - **Purpose**: Suppress UndefinedBehaviorSanitizer errors
- **Format**: `<error_type>:<pattern>` (e.g., `unsigned-integer-overflow:protobuf`) - **Format**: `<error_type>:<pattern>` (e.g., `unsigned-integer-overflow:protobuf`)
- **Covers**: Intentional overflows in external libraries (protobuf, gRPC, stdlib) - **Covers**: Intentional overflows in sanitizers/suppressions libraries (protobuf, gRPC, stdlib)
### `external/tsan.supp` ### `tsan.supp`
- **Purpose**: Suppress ThreadSanitizer data race warnings - **Purpose**: Suppress ThreadSanitizer data race warnings
- **Format**: `race:<pattern>` where pattern matches function/file names - **Format**: `race:<pattern>` where pattern matches function/file names
- **More info**: [ThreadSanitizerSuppressions](https://github.com/google/sanitizers/wiki/ThreadSanitizerSuppressions) - **More info**: [ThreadSanitizerSuppressions](https://github.com/google/sanitizers/wiki/ThreadSanitizerSuppressions)
### `external/sanitizer-ignorelist.txt` ### `sanitizer-ignorelist.txt`
- **Purpose**: Compile-time ignorelist for all sanitizers - **Purpose**: Compile-time ignorelist for all sanitizers
- **Usage**: Passed via `-fsanitize-ignorelist=absolute/path/to/sanitizer-ignorelist.txt` - **Usage**: Passed via `-fsanitize-ignorelist=absolute/path/to/sanitizer-ignorelist.txt`

View File

@@ -1,6 +1,6 @@
# The idea is to empty this file gradually by fixing the underlying issues and removing suppresions. # The idea is to empty this file gradually by fixing the underlying issues and removing suppresions.
# #
# ASAN_OPTIONS="detect_container_overflow=0:suppressions=external/asan.supp:halt_on_error=0" # ASAN_OPTIONS="detect_container_overflow=0 suppressions=sanitizers/suppressions/asan.supp halt_on_error=0"
# #
# The detect_container_overflow=0 option disables false positives from: # The detect_container_overflow=0 option disables false positives from:
# - Boost intrusive containers (slist_iterator.hpp, hashtable.hpp, aged_unordered_container.h) # - Boost intrusive containers (slist_iterator.hpp, hashtable.hpp, aged_unordered_container.h)
@@ -8,8 +8,8 @@
# #
# See: https://github.com/google/sanitizers/wiki/AddressSanitizerContainerOverflow # See: https://github.com/google/sanitizers/wiki/AddressSanitizerContainerOverflow
# Suprpress voilations in external code # Suprpress voilations in sanitizers/suppressions code
interceptor_name:^external interceptor_name:^sanitizers/suppressions
# Boost # Boost
interceptor_name:boost/asio interceptor_name:boost/asio