Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to opt-out of ASan container annotations on a per-allocator basis #5241

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3428840
add naive first implementation of per-allocator disablement of ASan
davidmrdavid Jan 16, 2025
790ac7e
improve comments
davidmrdavid Jan 16, 2025
846061c
Simplify implementation
davidmrdavid Jan 16, 2025
71c7716
constexpr if-statement and rename variable template
davidmrdavid Jan 16, 2025
0cfbb2f
checkpoint progress
davidmrdavid Jan 16, 2025
a040f8c
checkpoint progress: allocator is non-conforming still
davidmrdavid Jan 18, 2025
7bec17a
add seemingly compliant arena allocator. some TODOs and FIXMEs remain
davidmrdavid Jan 22, 2025
76e0723
remove whitespace
davidmrdavid Jan 22, 2025
516d2c0
add basic_string test and implementation
davidmrdavid Jan 23, 2025
6b04254
fix indentation
davidmrdavid Jan 23, 2025
a5de291
template new test
davidmrdavid Jan 23, 2025
4cc951b
remove use of arena allocator to simplify tests, basic_string test st…
davidmrdavid Jan 23, 2025
3f2111d
Merge branch 'main' of https://github.com/microsoft/STL into dev/daju…
davidmrdavid Jan 24, 2025
9823cb4
edit string test
davidmrdavid Jan 24, 2025
6188041
reference new GH bug in PR
davidmrdavid Jan 24, 2025
57e7aff
rename template variable as per feedback
davidmrdavid Jan 28, 2025
6c6545c
Merge branch 'main' of https://github.com/microsoft/STL into dev/daju…
davidmrdavid Jan 29, 2025
6d0b7b8
fixup tests
davidmrdavid Jan 30, 2025
cbb714d
clean up comments
davidmrdavid Jan 30, 2025
59fa3c9
Follow the "can_throw" pattern in copy assignment.
StephanTLavavej Jan 30, 2025
b6c5dca
Guard vector/string logic with `if constexpr (!disable)` to avoid dea…
StephanTLavavej Jan 30, 2025
9f68b17
Fix comments.
StephanTLavavej Jan 30, 2025
45709b9
Avoid shadowing: `vector` => `v`
StephanTLavavej Jan 30, 2025
af4fc60
Drop unnecessary `std::`.
StephanTLavavej Jan 30, 2025
1b66d92
Improve add_death_tests: add char, move char8_t, add trailing commas.
StephanTLavavej Jan 30, 2025
12c763f
Style: `T()` => `T{}`
StephanTLavavej Jan 30, 2025
44a336a
Disable for all `<T, Pocma, Stateless>` (and `typename` => `class` ni…
StephanTLavavej Jan 30, 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
4 changes: 4 additions & 0 deletions stl/inc/vector
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,10 @@ private:
return;
}

if (!is_ASan_enabled_for_allocator_v<allocator_type>) {
davidmrdavid marked this conversation as resolved.
Show resolved Hide resolved
return;
}

const void* const _First = _STD _Unfancy(_First_);
const void* const _End = _STD _Unfancy(_End_);
const void* const _Old_last = _STD _Unfancy(_Old_last_);
Expand Down
11 changes: 11 additions & 0 deletions stl/inc/xmemory
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,17 @@ struct _Simple_types { // wraps types from allocators with simple addressing for
_INLINE_VAR constexpr size_t _Asan_granularity = 8;
_INLINE_VAR constexpr size_t _Asan_granularity_mask = _Asan_granularity - 1;

// Represents whether ASan is enabled for allocator type 'T'.
davidmrdavid marked this conversation as resolved.
Show resolved Hide resolved
// By default, ASan is enabled.
template<typename T>
struct is_ASan_enabled_for_allocator {
static constexpr bool value = true;
};

// Convenience helper to determine if ASan is enabled for a given allocator type 'T'
template <typename T>
constexpr bool is_ASan_enabled_for_allocator_v = is_ASan_enabled_for_allocator<T>::value;
davidmrdavid marked this conversation as resolved.
Show resolved Hide resolved

struct _Asan_aligned_pointers {
const void* _First;
const void* _End;
Expand Down