mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
renaming and doc update
Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com>
This commit is contained in:
@@ -26,24 +26,24 @@ endif()
|
||||
message(STATUS "Configuring sanitizers: ${SANITIZERS}")
|
||||
|
||||
# Parse SANITIZERS value to determine which sanitizers to enable
|
||||
set(ENABLE_ASAN FALSE)
|
||||
set(ENABLE_TSAN FALSE)
|
||||
set(ENABLE_UBSAN FALSE)
|
||||
set(enable_asan FALSE)
|
||||
set(enable_tsan FALSE)
|
||||
set(enable_ubsan FALSE)
|
||||
|
||||
# Normalize SANITIZERS into a list
|
||||
set(_san_list "${SANITIZERS}")
|
||||
string(REPLACE "," ";" _san_list "${_san_list}")
|
||||
separate_arguments(_san_list)
|
||||
set(san_list "${SANITIZERS}")
|
||||
string(REPLACE "," ";" san_list "${san_list}")
|
||||
separate_arguments(san_list)
|
||||
|
||||
foreach(_san IN LISTS _san_list)
|
||||
if(_san STREQUAL "address")
|
||||
set(ENABLE_ASAN TRUE)
|
||||
elseif(_san STREQUAL "thread")
|
||||
set(ENABLE_TSAN TRUE)
|
||||
elseif(_san STREQUAL "undefinedbehavior")
|
||||
set(ENABLE_UBSAN TRUE)
|
||||
foreach(san IN LISTS san_list)
|
||||
if(san STREQUAL "address")
|
||||
set(enable_asan TRUE)
|
||||
elseif(san STREQUAL "thread")
|
||||
set(enable_tsan TRUE)
|
||||
elseif(san STREQUAL "undefinedbehavior")
|
||||
set(enable_ubsan TRUE)
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported sanitizer type: ${_san}"
|
||||
message(FATAL_ERROR "Unsupported sanitizer type: ${san}"
|
||||
"Supported: address, thread, undefinedbehavior and their combinations.")
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -54,13 +54,13 @@ set(SANITIZERS_COMPILE_FLAGS "-fno-omit-frame-pointer" "-O1")
|
||||
# Build the sanitizer flags list
|
||||
set(SANITIZERS_FLAGS)
|
||||
|
||||
if(ENABLE_ASAN)
|
||||
if(enable_asan)
|
||||
list(APPEND SANITIZERS_FLAGS "address")
|
||||
elseif(ENABLE_TSAN)
|
||||
elseif(enable_tsan)
|
||||
list(APPEND SANITIZERS_FLAGS "thread")
|
||||
endif()
|
||||
|
||||
if(ENABLE_UBSAN)
|
||||
if(enable_ubsan)
|
||||
# UB sanitizer flags
|
||||
if(is_clang)
|
||||
# Clang supports additional UB checks. More info here https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
|
||||
@@ -87,11 +87,11 @@ if(is_gcc)
|
||||
# Suppress false positive warnings in GCC with stringop-overflow
|
||||
list(APPEND SANITIZERS_COMPILE_FLAGS "-Wno-stringop-overflow")
|
||||
|
||||
if(is_amd64 AND ENABLE_ASAN)
|
||||
if(is_amd64 AND enable_asan)
|
||||
message(STATUS " Using large code model (-mcmodel=large)")
|
||||
list(APPEND SANITIZERS_COMPILE_FLAGS "-mcmodel=large")
|
||||
list(APPEND SANITIZERS_RELOCATION_FLAGS "-mcmodel=large")
|
||||
elseif(ENABLE_TSAN)
|
||||
elseif(enable_tsan)
|
||||
# GCC doesn't support atomic_thread_fence with tsan. Suppress warnings.
|
||||
list(APPEND SANITIZERS_COMPILE_FLAGS "-Wno-tsan")
|
||||
message(STATUS " Using medium code model (-mcmodel=medium)")
|
||||
@@ -139,18 +139,18 @@ target_compile_options(common INTERFACE
|
||||
target_link_options(common INTERFACE ${SANITIZERS_LINK_FLAGS})
|
||||
|
||||
# Define SANITIZERS macro for BuildInfo.cpp
|
||||
set(SANITIZERS_LIST)
|
||||
if(ENABLE_ASAN)
|
||||
list(APPEND SANITIZERS_LIST "ASAN")
|
||||
set(sanitizers_list)
|
||||
if(enable_asan)
|
||||
list(APPEND sanitizers_list "ASAN")
|
||||
endif()
|
||||
if(ENABLE_TSAN)
|
||||
list(APPEND SANITIZERS_LIST "TSAN")
|
||||
if(enable_tsan)
|
||||
list(APPEND sanitizers_list "TSAN")
|
||||
endif()
|
||||
if(ENABLE_UBSAN)
|
||||
list(APPEND SANITIZERS_LIST "UBSAN")
|
||||
if(enable_ubsan)
|
||||
list(APPEND sanitizers_list "UBSAN")
|
||||
endif()
|
||||
|
||||
if(SANITIZERS_LIST)
|
||||
list(JOIN SANITIZERS_LIST "." SANITIZERS_STR)
|
||||
target_compile_definitions(common INTERFACE SANITIZERS=${SANITIZERS_STR})
|
||||
if(sanitizers_list)
|
||||
list(JOIN sanitizers_list "." sanitizers_str)
|
||||
target_compile_definitions(common INTERFACE SANITIZERS=${sanitizers_str})
|
||||
endif()
|
||||
|
||||
13
docs/build/sanitizers.md
vendored
13
docs/build/sanitizers.md
vendored
@@ -102,7 +102,7 @@ export LSAN_OPTIONS="suppressions=path/to/lsan.supp:halt_on_error=0:log_path=lsa
|
||||
- Boost context switching (used in `Workers.cpp`) confuses ASAN's stack tracking
|
||||
- Since we usually don't build Boost(because we don't want to instrument Boost and detect issues in Boost code) with ASAN but use Boost containers in ASAN instrumented rippled code, it generates false positives. Building dependencies with ASAN instrumentation reduces false positives.
|
||||
- See: https://github.com/google/sanitizers/wiki/AddressSanitizerContainerOverflow
|
||||
- More such flags are detailed here: https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
|
||||
- More such flags are detailed [here](https://github.com/google/sanitizers/wiki/AddressSanitizerFlags)
|
||||
|
||||
### ThreadSanitizer (TSan)
|
||||
|
||||
@@ -113,7 +113,7 @@ export TSAN_OPTIONS="suppressions=path/to/tsan.supp halt_on_error=0 log_path=tsa
|
||||
./xrpld --unittest --unittest-jobs=5
|
||||
```
|
||||
|
||||
More details: https://github.com/google/sanitizers/wiki/ThreadSanitizerCppManual
|
||||
More details [here](https://github.com/google/sanitizers/wiki/ThreadSanitizerCppManual).
|
||||
|
||||
### LeakSanitizer (LSan)
|
||||
|
||||
@@ -123,7 +123,7 @@ LSan is automatically enabled with ASAN. To disable it:
|
||||
export ASAN_OPTIONS="detect_leaks=0"
|
||||
```
|
||||
|
||||
More details here: https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer
|
||||
More details [here](https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer).
|
||||
|
||||
### undefinedbehaviorSanitizer (UBSan)
|
||||
|
||||
@@ -134,7 +134,7 @@ export UBSAN_OPTIONS="suppressions=path/to/ubsan.supp:print_stacktrace=1:halt_on
|
||||
./xrpld --unittest --unittest-jobs=5
|
||||
```
|
||||
|
||||
More details here: https://clang.llvm.org/docs/undefinedbehaviorSanitizer.html
|
||||
More details [here](https://clang.llvm.org/docs/undefinedbehaviorSanitizer.html).
|
||||
|
||||
## Suppression Files
|
||||
|
||||
@@ -162,12 +162,13 @@ More details here: https://clang.llvm.org/docs/undefinedbehaviorSanitizer.html
|
||||
- **Purpose**: Suppress undefinedbehaviorSanitizer errors
|
||||
- **Format**: `<error_type>:<pattern>` (e.g., `unsigned-integer-overflow:protobuf`)
|
||||
- **Covers**: Intentional overflows in sanitizers/suppressions libraries (protobuf, gRPC, stdlib)
|
||||
- More info [UBSan suppressions](https://clang.llvm.org/docs/SanitizerSpecialCaseList.html).
|
||||
|
||||
### [`tsan.supp`](../../sanitizers/suppressions/tsan.supp)
|
||||
|
||||
- **Purpose**: Suppress ThreadSanitizer data race warnings
|
||||
- **Format**: `race:<pattern>` where pattern matches function/file names
|
||||
- **More info**: [ThreadSanitizerSuppressions](https://github.com/google/sanitizers/wiki/ThreadSanitizerSuppressions)
|
||||
- **More info**: [ThreadSanitizer suppressions](https://github.com/google/sanitizers/wiki/ThreadSanitizerSuppressions)
|
||||
|
||||
### [`sanitizer-ignorelist.txt`](../../sanitizers/suppressions/sanitizer-ignorelist.txt)
|
||||
|
||||
@@ -201,5 +202,5 @@ Then review the log files: `asan.log.*`, `ubsan.log.*`, `tsan.log.*`
|
||||
- [AddressSanitizer Wiki](https://github.com/google/sanitizers/wiki/AddressSanitizer)
|
||||
- [AddressSanitizer Flags](https://github.com/google/sanitizers/wiki/AddressSanitizerFlags)
|
||||
- [Container Overflow Detection](https://github.com/google/sanitizers/wiki/AddressSanitizerContainerOverflow)
|
||||
- [undefinedbehaviorSanitizer](https://clang.llvm.org/docs/undefinedbehaviorSanitizer.html)
|
||||
- [UndefinedBehavior Sanitizer](https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html)
|
||||
- [ThreadSanitizer](https://github.com/google/sanitizers/wiki/ThreadSanitizerCppManual)
|
||||
|
||||
Reference in New Issue
Block a user