Skip to content

Commit 0ca160d

Browse files
authored
CXX-3222 add UBSan coverage with extra alignment and fix extended alignment issues (#1329)
* Add UBSan coverage with extra alignment * Add bsoncxx::aligned_object<T> * Avoid leaking extended alignment requirements to parent objects * Replace std::aligned_storage with alignas + sizeof * Address -Walign-mismatch warnings for bson_t* returned by test_util::mock * Address -Walign-mismatch warnings for bson_t* passed by stack<T, size>::emplace_back * Add -static-libsan when compiling UBSan tasks with static libs
1 parent 86096f8 commit 0ca160d

File tree

9 files changed

+1116
-58
lines changed

9 files changed

+1116
-58
lines changed

.evergreen/config_generator/components/sanitizers.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
# pylint: disable=line-too-long
2323
# fmt: off
2424
MATRIX = [
25-
('rhel80', ['asan', ], ['shared', 'static'], [False, True], ['4.0', '8.0', 'latest'], ['single', 'replica', 'sharded']),
26-
('rhel80', [ 'ubsan'], [ 'static'], [False ], ['4.0', '8.0', 'latest'], ['single', 'replica', 'sharded']),
25+
('rhel80', ['asan', 'ubsan'], ['shared', 'static'], [False, True], ['4.0', '8.0', 'latest'], ['single', 'replica', 'sharded']),
2726
]
2827
# fmt: on
2928
# pylint: enable=line-too-long
@@ -101,7 +100,7 @@ def tasks():
101100
test_vars |= {
102101
'TEST_WITH_UBSAN': 'ON',
103102
'example_projects_cxxflags': '-fsanitize=undefined -fno-sanitize-recover=undefined -fno-omit-frame-pointer',
104-
'example_projects_ldflags': '-fsanitize=undefined -fno-sanitize-recover=undefined',
103+
'example_projects_ldflags': '-fsanitize=undefined -fno-sanitize-recover=undefined' + (' -static-libsan' if link_type == 'static' else ''),
105104
}
106105

107106
commands += [

0 commit comments

Comments
 (0)