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 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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