Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
c38b5aa
Added flow for the sanitizers build
pratikmankawde Nov 4, 2025
7ae3a85
formatting correction
pratikmankawde Nov 4, 2025
e95299d
code review changes
pratikmankawde Nov 5, 2025
977a087
code review changes
pratikmankawde Nov 5, 2025
21b9f6d
Merge branch 'develop' into pratik/Add-sanitizers-to-CI-builds
pratikmankawde Nov 5, 2025
3b32210
formatting changes
pratikmankawde Nov 5, 2025
db74ceb
added build with sanitizers ins.
pratikmankawde Nov 5, 2025
83eb93f
added back type
pratikmankawde Nov 5, 2025
0be98ac
made sanitizers optional
pratikmankawde Nov 5, 2025
ff0284e
removed sanitizers from script
pratikmankawde Nov 5, 2025
ada5230
passing sanitizers to on-pr and on-trigger
pratikmankawde Nov 5, 2025
b150fea
fixes sanitizer arg not available in build-test
pratikmankawde Nov 5, 2025
10a422d
seperate clang and gcc
pratikmankawde Nov 5, 2025
48a3e5e
special case only for gcc
pratikmankawde Nov 6, 2025
1cdd0bf
end of line
pratikmankawde Nov 6, 2025
e7da05e
added setting EOF-ExtraLine in clang-format
pratikmankawde Nov 6, 2025
30f7ef7
Merge branch 'develop' into pratik/Add-sanitizers-to-CI-builds
pratikmankawde Nov 6, 2025
0b1bd42
Add sanitizers to CI builds
pratikmankawde Nov 10, 2025
c15d639
minor revert in clang-format
pratikmankawde Nov 10, 2025
c0ecb9a
Merge branch 'develop' into pratik/Add-sanitizers-to-CI-builds
pratikmankawde Nov 10, 2025
34b10b8
merged develop
pratikmankawde Nov 10, 2025
1eb3cc4
fixed pre-commit check
pratikmankawde Nov 10, 2025
d077141
name to small case
pratikmankawde Nov 10, 2025
cb5a765
tryring escaped " in config file
pratikmankawde Nov 10, 2025
abfaac5
trying direct input placement
pratikmankawde Nov 10, 2025
7121267
don't build deps with sanitizers
pratikmankawde Nov 11, 2025
f5b473c
Merge branch 'develop' into pratik/Add-sanitizers-to-CI-builds
pratikmankawde Nov 11, 2025
4a0fc0f
formatting changes
pratikmankawde Nov 11, 2025
1f88697
trying suppression files
pratikmankawde Nov 11, 2025
39adc5a
fixes forgcc compilation errors.
pratikmankawde Nov 11, 2025
832c32d
formatting changes
pratikmankawde Nov 11, 2025
0029210
minor fix
pratikmankawde Nov 11, 2025
6b8d5b5
updated suppression file paths
pratikmankawde Nov 11, 2025
e347da9
added mcmodel flags for linker
pratikmankawde Nov 11, 2025
db5aa2d
added no-var-tracking
pratikmankawde Nov 11, 2025
e156ed4
minor formatting
pratikmankawde Nov 11, 2025
2178fb9
Merge branch 'develop' into pratik/Add-sanitizers-to-CI-builds
pratikmankawde Nov 11, 2025
ebf917a
no-var-tracking is gcc specific
pratikmankawde Nov 11, 2025
18b65fd
linked model flags specific to amd64
pratikmankawde Nov 11, 2025
72b3a03
Merge branch 'develop' into pratik/Add-sanitizers-to-CI-builds
pratikmankawde Nov 11, 2025
5478e4f
move working_dir up
pratikmankawde Nov 11, 2025
28885a4
path revert
pratikmankawde Nov 11, 2025
124b6ca
using GITHUB_WORKSPACE now
pratikmankawde Nov 11, 2025
9b92aaf
fixed path to atsan
pratikmankawde Nov 11, 2025
937dc87
another combi
pratikmankawde Nov 11, 2025
d9c26bd
another comb.
pratikmankawde Nov 11, 2025
f236554
added variable in an early action
pratikmankawde Nov 11, 2025
14f605b
minor
pratikmankawde Nov 11, 2025
2bc089a
Merge branch 'develop' into pratik/Add-sanitizers-to-CI-builds
pratikmankawde Nov 11, 2025
9abec17
commenting out windows and mac for now.
pratikmankawde Nov 11, 2025
a011d29
trying again with minor change
pratikmankawde Nov 11, 2025
5ef2ced
testing by printing asan_options
pratikmankawde Nov 11, 2025
20326a7
putting commented code back
pratikmankawde Nov 11, 2025
a9444d3
try 2
pratikmankawde Nov 11, 2025
5ea3b43
try 3
pratikmankawde Nov 11, 2025
695f4a2
try 4
pratikmankawde Nov 11, 2025
fd71277
try 5
pratikmankawde Nov 11, 2025
509d388
try 6
pratikmankawde Nov 11, 2025
b182b6a
try 6
pratikmankawde Nov 11, 2025
e687ab8
try 7
pratikmankawde Nov 11, 2025
916f000
try 8
pratikmankawde Nov 11, 2025
7d05090
setting variables in run
pratikmankawde Nov 11, 2025
2e5afa7
updated asan suppressions file
pratikmankawde Nov 12, 2025
6355eba
Merge branch 'develop' into pratik/Add-sanitizers-to-CI-builds
pratikmankawde Nov 12, 2025
dcd0553
sanitizer builds only for gcc15 and clang20. no linking check for san…
pratikmankawde Nov 12, 2025
ea4d062
added ubsan file
pratikmankawde Nov 12, 2025
1d76de8
minor correction
pratikmankawde Nov 12, 2025
b650852
static liking for gcc
pratikmankawde Nov 12, 2025
9b793cd
linker flag correction
pratikmankawde Nov 12, 2025
5e89bce
use mcmodel=large
pratikmankawde Nov 12, 2025
5f2a351
reverted mcmodel to medium
pratikmankawde Nov 12, 2025
1cc00cd
trying with " and dyn linking
pratikmankawde Nov 12, 2025
a93052e
added -fPIC flag
pratikmankawde Nov 12, 2025
09a6e46
pass sanitizer flags to linker as well
pratikmankawde Nov 12, 2025
2e53c5a
changed linker for gcc
pratikmankawde Nov 13, 2025
baee65b
fixing minor spacing issue
pratikmankawde Nov 13, 2025
b38ef53
trying lld.
pratikmankawde Nov 13, 2025
7edba0a
trying with mcmodel=large
pratikmankawde Nov 13, 2025
4248a1f
only set mcmodel=large for gcc
pratikmankawde Nov 13, 2025
8d6d2ec
trying with bfd
pratikmankawde Nov 13, 2025
4cf4802
for tsan only use medium
pratikmankawde Nov 13, 2025
73ab466
use gold+large
pratikmankawde Nov 14, 2025
f1561c5
use lld
pratikmankawde Nov 14, 2025
58b248d
pass lld flag to cmake
pratikmankawde Nov 14, 2025
e1403d5
skip mold, gold, lld
pratikmankawde Nov 14, 2025
013ff18
cleanup
pratikmankawde Nov 14, 2025
c0da028
Merge branch 'develop' into pratik/Add-sanitizers-to-CI-builds
pratikmankawde Nov 14, 2025
aac1076
minor cleanup
pratikmankawde Nov 14, 2025
89f9ede
cleanup
pratikmankawde Nov 14, 2025
8d8a0cb
Merge branch 'develop' into pratik/Add-sanitizers-to-CI-builds
pratikmankawde Nov 14, 2025
67946f4
more cleanup
pratikmankawde Nov 14, 2025
4277717
added afew suppressors
pratikmankawde Nov 14, 2025
6a89a54
tsan race suppression
pratikmankawde Nov 14, 2025
18b9b9d
updated supp files
pratikmankawde Nov 14, 2025
a9d134a
more chnages
pratikmankawde Nov 14, 2025
9f02692
adding asio to tsan.supp
pratikmankawde Nov 14, 2025
6610f46
trying diff. asan supp options
pratikmankawde Nov 16, 2025
8006a1e
removed leak type
pratikmankawde Nov 16, 2025
5a90149
trying without begin-regex
pratikmankawde Nov 17, 2025
4fc5c00
added lsan and updated tsan
pratikmankawde Nov 17, 2025
d8ff72b
updated asan and lsan
pratikmankawde Nov 17, 2025
2428c5c
added more suppressions
pratikmankawde Nov 17, 2025
e2c75f5
Merge branch 'develop' into pratik/Add-sanitizers-to-CI-builds
pratikmankawde Nov 17, 2025
d8c8900
updated supp files
pratikmankawde Nov 17, 2025
216ecf6
updated tsan and ubsan
pratikmankawde Nov 17, 2025
d01b1da
cleaned up linker flags
pratikmankawde Nov 18, 2025
a58df41
Merge branch 'develop' into pratik/Add-sanitizers-to-CI-builds
pratikmankawde Nov 18, 2025
7d7c659
target clang-21
pratikmankawde Nov 18, 2025
3b1e82b
revert back to clang-20
pratikmankawde Nov 18, 2025
9267756
fixed generate.py file " issue
pratikmankawde Nov 18, 2025
42cab6c
updated ubsan file
pratikmankawde Nov 18, 2025
640f9ff
Added more files to ubsan.supp
pratikmankawde Nov 18, 2025
4c0f7a3
few more additions
pratikmankawde Nov 18, 2025
0fcfcd0
more aggressive suppresions
pratikmankawde Nov 18, 2025
dd0408a
added blacklist file
pratikmankawde Nov 18, 2025
92a6c98
try blacklist file
pratikmankawde Nov 18, 2025
a3e42a0
alternate approach
pratikmankawde Nov 18, 2025
b6c313b
only use ignorelist in gcc
pratikmankawde Nov 18, 2025
2610e65
only for clang
pratikmankawde Nov 18, 2025
cb982e7
added pie flag and signal suppressions
pratikmankawde Nov 19, 2025
087e52e
suppress crashes in tsan intrumentation code
pratikmankawde Nov 19, 2025
10553fc
added few more suppressions in tsan.supp
pratikmankawde Nov 19, 2025
4f496db
few more additions
pratikmankawde Nov 19, 2025
5befd5d
added tsan option second_deadlock_stack=1 and more tsan supps
pratikmankawde Nov 19, 2025
d026d06
build conan deps with sanitizers to fix tsan crashes
pratikmankawde Nov 19, 2025
810f5e9
statically link sanitizers
pratikmankawde Nov 19, 2025
7d3fc5c
added static linking flags
pratikmankawde Nov 19, 2025
702d941
minor correction
pratikmankawde Nov 19, 2025
6407788
added halt on error=0 and -fno-pie
pratikmankawde Nov 19, 2025
1a08b97
Merge branch 'develop' into pratik/Add-sanitizers-to-CI-builds
pratikmankawde Nov 19, 2025
d4b0339
removed static linking.
pratikmankawde Nov 19, 2025
4430cb6
trying a diff. sanitizer-blacklist syntax
pratikmankawde Nov 19, 2025
39ace64
updated blacklist file
pratikmankawde Nov 19, 2025
6e32392
added no-PIC
pratikmankawde Nov 21, 2025
32d129e
Merge branch 'develop' into pratik/Add-sanitizers-to-CI-builds
pratikmankawde Nov 21, 2025
facb6c6
cleanup and additions to asan, ubsan suppressions
pratikmankawde Nov 21, 2025
dd9e554
added readme.
pratikmankawde Nov 21, 2025
49f8daf
updated link
pratikmankawde Nov 21, 2025
9cdabe9
link to sanitizer_readme.md
pratikmankawde Nov 21, 2025
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
6 changes: 6 additions & 0 deletions .github/actions/build-deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ inputs:
description: "The logging verbosity."
required: false
default: "verbose"
sanitizers:
description: "The sanitizers to enable ('Address', 'Thread')."
required: false
default: ""

runs:
using: composite
Expand All @@ -33,11 +37,13 @@ runs:
BUILD_OPTION: ${{ inputs.force_build == 'true' && '*' || 'missing' }}
BUILD_TYPE: ${{ inputs.build_type }}
LOG_VERBOSITY: ${{ inputs.log_verbosity }}
SANITIZERS: ${{ inputs.sanitizers }}
run: |
echo 'Installing dependencies.'
mkdir -p "${BUILD_DIR}"
cd "${BUILD_DIR}"
conan install \
--profile ci \
--output-folder . \
--build="${BUILD_OPTION}" \
--options:host='&:tests=True' \
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/setup-conan/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ runs:
shell: bash
run: |
echo 'Installing profile.'
conan config install conan/profiles/default -tf $(conan config home)/profiles/
conan config install conan/profiles/ -tf $(conan config home)/profiles/

echo 'Conan profile:'
conan profile show
Expand Down
150 changes: 123 additions & 27 deletions .github/scripts/strategy-matrix/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,18 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
if os['distro_name'] == 'debian':
skip = True
if os['distro_version'] == 'bookworm':
if f'{os['compiler_name']}-{os['compiler_version']}' == 'gcc-13' and build_type == 'Release' and '-Dunity=ON' in cmake_args and architecture['platform'] == 'linux/amd64':
if f'{os["compiler_name"]}-{os["compiler_version"]}' == 'gcc-13' and build_type == 'Release' and '-Dunity=ON' in cmake_args and architecture['platform'] == 'linux/amd64':
cmake_args = f'-DUNIT_TEST_REFERENCE_FEE=500 {cmake_args}'
skip = False
if f'{os['compiler_name']}-{os['compiler_version']}' == 'gcc-15' and build_type == 'Debug' and '-Dunity=OFF' in cmake_args and architecture['platform'] == 'linux/amd64':
if f'{os["compiler_name"]}-{os["compiler_version"]}' == 'gcc-15' and build_type == 'Debug' and '-Dunity=OFF' in cmake_args and architecture['platform'] == 'linux/amd64':
skip = False
if f'{os['compiler_name']}-{os['compiler_version']}' == 'clang-16' and build_type == 'Debug' and '-Dunity=OFF' in cmake_args and architecture['platform'] == 'linux/arm64':
if f'{os["compiler_name"]}-{os["compiler_version"]}' == 'clang-16' and build_type == 'Debug' and '-Dunity=OFF' in cmake_args and architecture['platform'] == 'linux/arm64':
cmake_args = f'-Dvoidstar=ON {cmake_args}'
skip = False
if f'{os['compiler_name']}-{os['compiler_version']}' == 'clang-17' and build_type == 'Release' and '-Dunity=ON' in cmake_args and architecture['platform'] == 'linux/amd64':
if f'{os["compiler_name"]}-{os["compiler_version"]}' == 'clang-17' and build_type == 'Release' and '-Dunity=ON' in cmake_args and architecture['platform'] == 'linux/amd64':
cmake_args = f'-DUNIT_TEST_REFERENCE_FEE=1000 {cmake_args}'
skip = False
if f'{os['compiler_name']}-{os['compiler_version']}' == 'clang-20' and build_type == 'Debug' and '-Dunity=ON' in cmake_args and architecture['platform'] == 'linux/amd64':
if f'{os["compiler_name"]}-{os["compiler_version"]}' == 'clang-20' and build_type == 'Debug' and '-Dunity=ON' in cmake_args and architecture['platform'] == 'linux/amd64':
skip = False
if skip:
continue
Expand All @@ -79,10 +79,10 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
if os['distro_name'] == 'rhel':
skip = True
if os['distro_version'] == '9':
if f'{os['compiler_name']}-{os['compiler_version']}' == 'gcc-12' and build_type == 'Debug' and '-Dunity=ON' in cmake_args and architecture['platform'] == 'linux/amd64':
if f'{os["compiler_name"]}-{os["compiler_version"]}' == 'gcc-12' and build_type == 'Debug' and '-Dunity=ON' in cmake_args and architecture['platform'] == 'linux/amd64':
skip = False
elif os['distro_version'] == '10':
if f'{os['compiler_name']}-{os['compiler_version']}' == 'clang-any' and build_type == 'Release' and '-Dunity=OFF' in cmake_args and architecture['platform'] == 'linux/amd64':
if f'{os["compiler_name"]}-{os["compiler_version"]}' == 'clang-any' and build_type == 'Release' and '-Dunity=OFF' in cmake_args and architecture['platform'] == 'linux/amd64':
skip = False
if skip:
continue
Expand All @@ -95,14 +95,14 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
if os['distro_name'] == 'ubuntu':
skip = True
if os['distro_version'] == 'jammy':
if f'{os['compiler_name']}-{os['compiler_version']}' == 'gcc-12' and build_type == 'Debug' and '-Dunity=OFF' in cmake_args and architecture['platform'] == 'linux/arm64':
if f'{os["compiler_name"]}-{os["compiler_version"]}' == 'gcc-12' and build_type == 'Debug' and '-Dunity=OFF' in cmake_args and architecture['platform'] == 'linux/arm64':
skip = False
elif os['distro_version'] == 'noble':
if f'{os['compiler_name']}-{os['compiler_version']}' == 'gcc-14' and build_type == 'Release' and '-Dunity=ON' in cmake_args and architecture['platform'] == 'linux/amd64':
if f'{os["compiler_name"]}-{os["compiler_version"]}' == 'gcc-14' and build_type == 'Release' and '-Dunity=ON' in cmake_args and architecture['platform'] == 'linux/amd64':
skip = False
if f'{os['compiler_name']}-{os['compiler_version']}' == 'clang-18' and build_type == 'Debug' and '-Dunity=OFF' in cmake_args and architecture['platform'] == 'linux/amd64':
if f'{os["compiler_name"]}-{os["compiler_version"]}' == 'clang-18' and build_type == 'Debug' and '-Dunity=OFF' in cmake_args and architecture['platform'] == 'linux/amd64':
skip = False
if f'{os['compiler_name']}-{os['compiler_version']}' == 'clang-19' and build_type == 'Release' and '-Dunity=ON' in cmake_args and architecture['platform'] == 'linux/arm64':
if f'{os["compiler_name"]}-{os["compiler_version"]}' == 'clang-19' and build_type == 'Release' and '-Dunity=ON' in cmake_args and architecture['platform'] == 'linux/arm64':
skip = False
if skip:
continue
Expand All @@ -117,10 +117,9 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
if os['distro_name'] == 'windows' and not (build_type == 'Release' and '-Dunity=ON' in cmake_args and architecture['platform'] == 'windows/amd64'):
continue


# Additional CMake arguments.
cmake_args = f'{cmake_args} -Dtests=ON -Dwerr=ON -Dxrpld=ON'
if not f'{os['compiler_name']}-{os['compiler_version']}' in ['gcc-12', 'clang-16']:
if not f'{os["compiler_name"]}-{os["compiler_version"]}' in ['gcc-12', 'clang-16']:
cmake_args = f'{cmake_args} -Dwextra=ON'
if build_type == 'Release':
cmake_args = f'{cmake_args} -Dassert=ON'
Expand All @@ -131,13 +130,15 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
continue

# We skip all clang 20+ on arm64 due to Boost build error.
if f'{os['compiler_name']}-{os['compiler_version']}' in ['clang-20', 'clang-21'] and architecture['platform'] == 'linux/arm64':
if f'{os["compiler_name"]}-{os["compiler_version"]}' in ['clang-20', 'clang-21'] and architecture['platform'] == 'linux/arm64':
continue

# Enable code coverage for Debian Bookworm using GCC 15 in Debug and no
cxx_flags = '-g'
# Enable code coverage for Debian Bookworm using GCC 14 in Debug and no
# Unity on linux/amd64
if f'{os['compiler_name']}-{os['compiler_version']}' == 'gcc-15' and build_type == 'Debug' and '-Dunity=OFF' in cmake_args and architecture['platform'] == 'linux/amd64':
cmake_args = f'-Dcoverage=ON -Dcoverage_format=xml -DCODE_COVERAGE_VERBOSE=ON -DCMAKE_C_FLAGS=-O0 -DCMAKE_CXX_FLAGS=-O0 {cmake_args}'
if f'{os["compiler_name"]}-{os["compiler_version"]}' == 'gcc-14' and build_type == 'Debug' and '-Dunity=OFF' in cmake_args and architecture['platform'] == 'linux/amd64':
cmake_args = f'-Dcoverage=ON -Dcoverage_format=xml -DCODE_COVERAGE_VERBOSE=ON -DCMAKE_C_FLAGS=-O0 {cmake_args}'
cxx_flags = f'-O0 {cxx_flags}'

# Generate a unique name for the configuration, e.g. macos-arm64-debug
# or debian-bookworm-gcc-12-amd64-release-unity.
Expand All @@ -148,23 +149,118 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
config_name += f'-{n}'
if (n := os['compiler_version']) != '':
config_name += f'-{n}'
config_name += f'-{architecture['platform'][architecture['platform'].find('/')+1:]}'
config_name += f'-{architecture["platform"][architecture["platform"].find("/")+1:]}'
config_name += f'-{build_type.lower()}'
if '-Dunity=ON' in cmake_args:
config_name += '-unity'

# Add the configuration to the list, with the most unique fields first,
# so that they are easier to identify in the GitHub Actions UI, as long
# names get truncated.
configurations.append({
'config_name': config_name,
'cmake_args': cmake_args,
'cmake_target': cmake_target,
'build_only': build_only,
'build_type': build_type,
'os': os,
'architecture': architecture,
})
# Add Address and Thread (both coupled with UB) sanitizers when the distro is bookworm.
if os['distro_version'] == 'bookworm' and f'{os["compiler_name"]}-{os["compiler_version"]}' in {'gcc-15', 'clang-20'}:
extra_warning_flags = ''
linker_relocation_flags = ''
linker_flags = ''

# Use large code model to avoid relocation errors with large binaries
# Only for x86-64 (amd64) - ARM64 doesn't support -mcmodel=large
if architecture['platform'] == 'linux/amd64' and os['compiler_name'] == 'gcc':
# Add -mcmodel=large to both compiler AND linker flags
# This is needed because sanitizers create very large binaries and
# large model removes the 2GB limitation that medium model has
cxx_flags += ' -mcmodel=large -fno-PIC'
linker_relocation_flags+=' -mcmodel=large -fno-PIC'

# Create default sanitizer flags
sanitizers_flags = 'undefined,float-divide-by-zero'

if os['compiler_name'] == 'gcc':
sanitizers_flags = f'{sanitizers_flags},signed-integer-overflow'
# Suppress false positive warnings in GCC with stringop-overflow
extra_warning_flags += ' -Wno-stringop-overflow'
# Disable mold, gold and lld linkers.
# Use default linker (bfd/ld) which is more lenient with mixed code models
cmake_args += ' -Duse_mold=OFF -Duse_gold=OFF -Duse_lld=OFF'
# Add linker flags for Sanitizers
linker_flags += f' -DCMAKE_EXE_LINKER_FLAGS="{linker_relocation_flags} -fsanitize=address,{sanitizers_flags}"'
linker_flags += f' -DCMAKE_SHARED_LINKER_FLAGS="{linker_relocation_flags} -fsanitize=address,{sanitizers_flags}"'
elif os['compiler_name'] == 'clang':
# Note: We use $GITHUB_WORKSPACE environment variable which will be expanded by the shell
# 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.
# GCC doesn't support ignorelist.
cxx_flags += ' -fsanitize-ignorelist=$GITHUB_WORKSPACE/external/sanitizer-ignorelist.txt'
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_SHARED_LINKER_FLAGS="-fsanitize=address,{sanitizers_flags}"'

# Sanitizers recommend minimum of -O1 for reasonable performance
if "-O0" in cxx_flags:
cxx_flags = cxx_flags.replace("-O0", "-O1")
else:
cxx_flags += " -O1"

# First create config for asan
cmake_args_flags = f'{cmake_args} -DCMAKE_CXX_FLAGS="-fsanitize=address,{sanitizers_flags} -fno-omit-frame-pointer {cxx_flags} {extra_warning_flags}" {linker_flags}'

# Add config with asan
configurations.append({
'config_name': config_name + "_asan",
'cmake_args': cmake_args_flags,
'cmake_target': cmake_target,
'build_only': build_only,
'build_type': build_type,
'os': os,
'architecture': architecture,
'sanitizers': 'Address'
})
# Since TSAN runs are crashing with seg faults(could be compatibility issues with latest compilers)
# We deactivate it for now. But I would keep the code, since it took some effort to find the correct set of config needed to run this.
# This will be useful when we decide to activate it again in future.
activateTSAN = False
if activateTSAN:
linker_flags = ''
# Update configs for tsan
# gcc doesn't supports atomic_thread_fence with tsan. Suppress warnings.
# Also tsan doesn't work well with mcmode=large and bfd linker
if os['compiler_name'] == 'gcc':
extra_warning_flags += ' -Wno-tsan'
cxx_flags = cxx_flags.replace('-mcmodel=large', '-mcmodel=medium')
linker_relocation_flags = linker_relocation_flags.replace('-mcmodel=large', '-mcmodel=medium')
# Add linker flags for Sanitizers
linker_flags += f' -DCMAKE_EXE_LINKER_FLAGS="{linker_relocation_flags} -fsanitize=thread,{sanitizers_flags}"'
linker_flags += f' -DCMAKE_SHARED_LINKER_FLAGS="{linker_relocation_flags} -fsanitize=thread,{sanitizers_flags}"'
elif os['compiler_name'] == 'clang':
linker_flags += f' -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=thread,{sanitizers_flags}"'
linker_flags += f' -DCMAKE_SHARED_LINKER_FLAGS="-fsanitize=thread,{sanitizers_flags}"'

cmake_args_flags = f'{cmake_args} -DCMAKE_CXX_FLAGS="-fsanitize=thread,{sanitizers_flags} -fno-omit-frame-pointer {cxx_flags} {extra_warning_flags}" {linker_flags}'

configurations.append({
'config_name': config_name+ "_tsan",
'cmake_args': cmake_args_flags,
'cmake_target': cmake_target,
'build_only': build_only,
'build_type': build_type,
'os': os,
'architecture': architecture,
'sanitizers': 'Thread'
})
else:
if cxx_flags:
cmake_args_flags = f'{cmake_args} -DCMAKE_CXX_FLAGS={cxx_flags}'
else:
cmake_args_flags = f'{cmake_args}'
configurations.append({
'config_name': config_name,
'cmake_args': cmake_args_flags,
'cmake_target': cmake_target,
'build_only': build_only,
'build_type': build_type,
'os': os,
'architecture': architecture
})

return configurations

Expand Down
24 changes: 19 additions & 5 deletions .github/workflows/reusable-build-test-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ on:
type: number
default: 2

sanitizers:
description: "The sanitizers to enable ('Address+UndefinedBehaviour' or 'Thread+UndefinedBehaviour')."
required: false
type: string
default: "None"

secrets:
CODECOV_TOKEN:
description: "The Codecov token to use for uploading coverage reports."
Expand All @@ -68,6 +74,7 @@ jobs:
env:
ENABLED_VOIDSTAR: ${{ contains(inputs.cmake_args, '-Dvoidstar=ON') }}
ENABLED_COVERAGE: ${{ contains(inputs.cmake_args, '-Dcoverage=ON') }}
ENABLED_SANITIZERS: ${{ contains(inputs.cmake_args, '-fsanitize') }}
steps:
- name: Cleanup workspace (macOS and Windows)
if: ${{ runner.os == 'macOS' || runner.os == 'Windows' }}
Expand Down Expand Up @@ -102,19 +109,18 @@ jobs:
# Set the verbosity to "quiet" for Windows to avoid an excessive
# amount of logs. For other OSes, the "verbose" logs are more useful.
log_verbosity: ${{ runner.os == 'Windows' && 'quiet' || 'verbose' }}
sanitizers: ${{ inputs.sanitizers }}

- name: Configure CMake
working-directory: ${{ inputs.build_dir }}
env:
BUILD_TYPE: ${{ inputs.build_type }}
CMAKE_ARGS: ${{ inputs.cmake_args }}
run: |
cmake \
cmake .. \
-G '${{ runner.os == 'Windows' && 'Visual Studio 17 2022' || 'Ninja' }}' \
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
${CMAKE_ARGS} \
..
${{ inputs.cmake_args }}

- name: Build the binary
working-directory: ${{ inputs.build_dir }}
Expand All @@ -141,7 +147,7 @@ jobs:
if-no-files-found: error

- name: Check linking (Linux)
if: ${{ runner.os == 'Linux' }}
if: ${{ runner.os == 'Linux' && env.ENABLED_SANITIZERS == 'false' }}
working-directory: ${{ inputs.build_dir }}
run: |
ldd ./rippled
Expand All @@ -166,6 +172,10 @@ jobs:
BUILD_TYPE: ${{ inputs.build_type }}
PARALLELISM: ${{ runner.os == 'Windows' && '1' || steps.nproc.outputs.nproc }}
run: |
export ASAN_OPTIONS="detect_container_overflow=0 suppressions=$GITHUB_WORKSPACE/external/asan.supp"
export TSAN_OPTIONS="second_deadlock_stack=1 halt_on_error=0 suppressions=$GITHUB_WORKSPACE/external/tsan.supp"
export UBSAN_OPTIONS="suppressions=$GITHUB_WORKSPACE/external/ubsan.supp"
export LSAN_OPTIONS="suppressions=$GITHUB_WORKSPACE/external/lsan.supp"
ctest \
--output-on-failure \
-C "${BUILD_TYPE}" \
Expand All @@ -177,6 +187,10 @@ jobs:
env:
BUILD_NPROC: ${{ steps.nproc.outputs.nproc }}
run: |
export ASAN_OPTIONS="detect_container_overflow=0 suppressions=$GITHUB_WORKSPACE/external/asan.supp"
export TSAN_OPTIONS="second_deadlock_stack=1 halt_on_error=0 suppressions=$GITHUB_WORKSPACE/external/tsan.supp"
export UBSAN_OPTIONS="suppressions=$GITHUB_WORKSPACE/external/ubsan.supp"
export LSAN_OPTIONS="suppressions=$GITHUB_WORKSPACE/external/lsan.supp"
./rippled --unittest --unittest-jobs "${BUILD_NPROC}"

- name: Debug failure (Linux)
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/reusable-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ jobs:
runs_on: ${{ toJSON(matrix.architecture.runner) }}
image: ${{ contains(matrix.architecture.platform, 'linux') && format('ghcr.io/xrplf/ci/{0}-{1}:{2}-{3}-sha-{4}', matrix.os.distro_name, matrix.os.distro_version, matrix.os.compiler_name, matrix.os.compiler_version, matrix.os.image_sha) || '' }}
config_name: ${{ matrix.config_name }}
sanitizers: ${{ matrix.sanitizers }}
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
Loading
Loading