Skip to content

Conversation

@cbezault
Copy link
Contributor

Add ASan container annotations to vector. This should allow ASan to catch additional errors when using vector.
Specifically this will catch accesses from [v.data() + v.size(), v.data() + v.capacity()) which would otherwise be missed as they are legal memory addresses.

Closes #2030

@cbezault cbezault added the enhancement Something can be improved label Jul 21, 2021
@StephanTLavavej

This comment has been minimized.

@cbezault

This comment has been minimized.

@AlexGuteniev

This comment has been minimized.

@cbezault

This comment has been minimized.

@StephanTLavavej StephanTLavavej marked this pull request as ready for review July 28, 2021 21:23
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner July 28, 2021 21:23
@CaseyCarter CaseyCarter assigned cbezault and unassigned CaseyCarter Jul 29, 2021
@StephanTLavavej

This comment has been minimized.

@StephanTLavavej StephanTLavavej removed their assignment Nov 23, 2021
@cbezault
Copy link
Contributor Author

cbezault commented Nov 23, 2021

FYI, internal MSVC-PR-356165 needs to be merged before this can be merged internally.

Co-authored-by: Michael Schellenberger Costa <[email protected]>
@StephanTLavavej

This comment has been minimized.

@StephanTLavavej
Copy link
Member

StephanTLavavej commented Dec 1, 2021

✔️ MSVC-PR mirroring note:

As this PR adds new source files and a new lib, we'll need to update setup - done in MSVC-PR-368993.

#pragma comment(linker, \
"/alternatename:___sanitizer_annotate_contiguous_container=___sanitizer_annotate_contiguous_container_default")
#pragma comment(linker, "/alternatename:__Asan_vector_should_annotate=__Asan_vector_should_annotate_default")
#elif defined(_M_X64) || defined(_M_ARM) || defined(_M_ARM64)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I observe that there may be interesting ARM64EC (or CHPE) interactions with name mangling, but I can't point to specific issues, so no change requested.

@StephanTLavavej StephanTLavavej removed their assignment Dec 10, 2021
@StephanTLavavej StephanTLavavej merged commit 2f9f567 into microsoft:main Dec 11, 2021
@StephanTLavavej
Copy link
Member

Thanks for this major improvement to the STL's most important data structure! 🚀 ✔️ 🎉 😻

@cbezault
Copy link
Contributor Author

Good luck with string!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Something can be improved high priority Important!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

<vector>: Annotate vector for use with ASan

6 participants