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

<vector>: Add ASan annotations. #2071

Merged
merged 68 commits into from
Dec 11, 2021
Merged

<vector>: Add ASan annotations. #2071

merged 68 commits into from
Dec 11, 2021

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
stl/inc/vector Outdated Show resolved Hide resolved
stl/inc/vector Outdated Show resolved Hide resolved
stl/inc/vector Outdated Show resolved Hide resolved
stl/inc/vector Outdated Show resolved Hide resolved
stl/inc/vector Outdated Show resolved Hide resolved
stl/inc/vector Outdated Show resolved Hide resolved
stl/inc/vector Outdated Show resolved Hide resolved
stl/inc/vector Outdated Show resolved Hide resolved
stl/inc/vector Outdated Show resolved Hide resolved
stl/inc/vector Outdated Show resolved Hide resolved
stl/inc/vector Outdated Show resolved Hide resolved
stl/inc/vector Outdated Show resolved Hide resolved
@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
tests/std/tests/GH_002030_asan_annotate_vector/env.lst Outdated Show resolved Hide resolved
tests/std/tests/GH_002030_asan_annotate_vector/test.cpp Outdated Show resolved Hide resolved
tests/std/tests/GH_002030_asan_annotate_vector/test.cpp Outdated Show resolved Hide resolved
tests/std/tests/GH_002030_asan_annotate_vector/test.cpp Outdated Show resolved Hide resolved
tests/std/tests/GH_002030_asan_annotate_vector/test.cpp Outdated Show resolved Hide resolved
stl/inc/vector Outdated Show resolved Hide resolved
stl/inc/vector Show resolved Hide resolved
stl/inc/vector Outdated Show resolved Hide resolved
stl/inc/vector Show resolved Hide resolved
stl/inc/vector Outdated Show resolved Hide resolved
@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.

stl/inc/vector Show resolved Hide resolved
stl/inc/vector Show resolved Hide resolved
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.

stl/inc/vector Outdated Show resolved Hide resolved
#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
tests/utils/stl/test/tests.py Show resolved Hide resolved
@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