-
Notifications
You must be signed in to change notification settings - Fork 1.6k
<vector>: Add ASan annotations.
#2071
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
Merged
Merged
Changes from all commits
Commits
Show all changes
68 commits
Select commit
Hold shift + click to select a range
46a84b6
Initial asan annotation commit
cbezault b6cf70c
Some testing fixups
cbezault daa4db9
First working pass at asan annotations
cbezault 72f27a9
Merge branch 'main' of https://github.com/Microsoft/STL
cbezault 67b9a50
Fixup merge error and env.lst
cbezault a50a9e8
clang-format
cbezault ecca61c
More clang-format
cbezault 9b3bad0
Remove unused variable
cbezault ae3ecd1
Add ASan to the CI image
cbezault 7a43662
Update stl/inc/vector
cbezault 295cb82
Apply suggestions from code review
cbezault 4bc1d3e
Update VMSS to add ASAN.
StephanTLavavej 201e707
Resolve most of Misco's comments
cbezault 32ece64
Address Alex's comments
cbezault 0e05186
Require x86 or x64
cbezault 4001372
Apply suggestions from code review
cbezault 84bcc99
Update stl/inc/vector
cbezault 8540313
Merge branch 'main' into gh2071
StephanTLavavej 521b8fe
Merge branch 'main' into gh2071
StephanTLavavej a1a004c
clang-format.
StephanTLavavej c9c77f9
Merge branch 'main' of https://github.com/cbezault/STL
cbezault 632566b
Fixup tests and annotations
cbezault 3a09cd9
Remove unused types
cbezault 138752a
Resolve PR comments
cbezault 9977914
Merge branch 'main' of https://github.com/Microsoft/STL
cbezault d977cf9
sigh, missed a file
cbezault 9dd9d6c
Remove shouty banners from bad merge
cbezault 3d43d92
Resolve comments
cbezault 0a6d34f
Resolve more comments
cbezault 56a3d83
Resolve PR comments
cbezault 873dd34
Expand the allocator aware tests to also run at compile time and fix …
miscco fe7e654
Cleanup the test a bit
miscco 513f645
Merge branch 'main' into fix_constexpr_vector_again
miscco f97defa
Add Bug citation for EDG
miscco 4fc4765
Typo in tests/std/tests/VSO_0000000_allocator_propagation
CaseyCarter 74cd839
Make the test classier, like a tuxedo cat!
StephanTLavavej 35c0a06
Cleanup move assignment
miscco 102e358
Clean up the different assignment helpers
miscco dc735af
Asan implementation for vector
miscco 07431d2
Merge Misco's changes
cbezault 6179818
Only link in stl_asan.lib when __SANITIZE_ADDRESS__ is defined
cbezault f2c0f11
Cleanup whitespace changes
cbezault 14364c9
Add pragma detect mismatch
cbezault 14fbbb2
Add asan_noop file
cbezault 422930a
Some more cleanups
cbezault afdaa81
Merge branch 'main' of https://github.com/Microsoft/STL
cbezault 705a00e
Many of Casey's review comments
CaseyCarter 0e49ba2
Cleanup types of arguments to the _ASAN_VECTOR_MEOW macros
CaseyCarter 159ac35
More msbuild stuff + Casey's comments
cbezault 2559230
Add alignment to std::allocator
cbezault c4fb4af
Update alignment check variable
cbezault 318d472
clang-format
cbezault 336b40c
Try catch when filling a new buffer
cbezault ebea23a
Make a new type to guard creating a new asan annotated vector with po…
cbezault d55025b
Add tests with noexcept non-trivial type and exceptable trivial type
cbezault cdd62a8
More msbuild changes
cbezault aa67435
Address review comments
cbezault 33e22ad
Turn on vector annotation and tests for clang-cl
cbezault e5ced0f
x86 needs an additional leading underscore
cbezault 4fe40a3
Resolve merge conflict
cbezault 4094aa6
Fixup bad find/replace
cbezault 934985d
Code review feedback.
StephanTLavavej 32702bf
Access control for guard data members.
StephanTLavavej 159f370
Don't include for CLR
cbezault 032983d
Fixup x86 symbols
cbezault a8dae00
Set _ANNOTATE_VECTOR in internal msbuild
cbezault 9596451
Update tests so they have some more coverage and should work in both …
cbezault 5dff266
Test fixup
cbezault File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <!-- | ||
| Copyright (c) Microsoft Corporation. | ||
| SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| --> | ||
|
|
||
| <Import Project="$(MSBuildThisFileDirectory)..\..\..\..\crt-common.settings.targets" /> | ||
|
|
||
| <ItemGroup Condition="'$(BuildExePhase)' == '1'"> | ||
| <ProjectFile Include="stl_asan.nativeproj" /> | ||
| </ItemGroup> | ||
|
|
||
| <Import Project="$(_NTDRIVE)$(_NTROOT)\tools\Microsoft.DevDiv.Traversal.targets" /> | ||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="Dogfood"> | ||
| <!-- | ||
| Copyright (c) Microsoft Corporation. | ||
| SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| --> | ||
|
|
||
| <ItemGroup> | ||
| <BuildFiles Include=" | ||
| $(CrtRoot)\github\stl\src\asan.cpp; | ||
| "> | ||
| <BuildAs>nativecpp</BuildAs> | ||
| </BuildFiles> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="Dogfood"> | ||
| <!-- | ||
| Copyright (c) Microsoft Corporation. | ||
| SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| --> | ||
|
|
||
| <PropertyGroup> | ||
| <Arm64X>true</Arm64X> | ||
| </PropertyGroup> | ||
|
|
||
| <Import Project="$(MSBuildThisFileDirectory)stl_asan.settings.targets"/> | ||
|
|
||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="Dogfood"> | ||
| <!-- | ||
| Copyright (c) Microsoft Corporation. | ||
| SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| --> | ||
|
|
||
| <PropertyGroup> | ||
| <FinalBinary>p_stl_asan</FinalBinary> | ||
| <TargetType>LIBRARY</TargetType> | ||
| <Arm64CombinedPdb>true</Arm64CombinedPdb> | ||
| </PropertyGroup> | ||
|
|
||
| <Import Project="$(MSBuildThisFileDirectory)..\..\..\..\crt_build.settings.targets"/> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputName>stl_asan</OutputName> | ||
| </PropertyGroup> | ||
|
|
||
| <PropertyGroup> | ||
| <ClProgramDataBaseFileName>$(OutputLibPdbPath)$(OutputName)$(PdbVerName).pdb</ClProgramDataBaseFileName> | ||
| </PropertyGroup> | ||
|
|
||
| <Import Project="$(MSBuildThisFileDirectory)stl_asan.files.settings.targets"/> | ||
|
|
||
| <Import Project="$(VCToolsRootPath)\crt\crt_build.targets"/> | ||
| <Target Name="GetBaseAddress"/> | ||
|
|
||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
|
||
| namespace std { | ||
| extern "C" { | ||
| extern const bool _Asan_vector_should_annotate = true; | ||
| } | ||
| } // namespace std |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
|
||
| extern "C" { | ||
| extern const bool _Asan_vector_should_annotate_default = false; | ||
|
|
||
| void __cdecl __sanitizer_annotate_contiguous_container_default( | ||
| const void*, const void*, const void*, const void*) noexcept {} | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
|
||
| # This test matrix is the usual test matrix, with all currently unsupported options removed, crossed with the ASan flags. | ||
| # TRANSITION, VSO-1350252 | ||
| # Due to a bug in the ASan libs using ASan with /MD or /MT requires IDL==0 and using /MDd or /MTd requires IDL==2. | ||
cbezault marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # clang-cl does not currently support targeting /MDd or /MTd. | ||
| RUNALL_INCLUDE ..\prefix.lst | ||
| RUNALL_CROSSLIST | ||
| PM_CL="/Zi /wd4611 /w14640 /Zc:threadSafeInit-" PM_LINK="/debug" | ||
| RUNALL_CROSSLIST | ||
| PM_CL="-fsanitize=address /BE /c /EHsc /MD /std:c++14 /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="-fsanitize=address /BE /c /EHsc /MDd /std:c++17 /permissive- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="-fsanitize=address /BE /c /EHsc /MT /std:c++20 /permissive- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="-fsanitize=address /BE /c /EHsc /MTd /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="-fsanitize=address /EHsc /MD /std:c++14 /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="-fsanitize=address /EHsc /MD /std:c++17 /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="-fsanitize=address /EHsc /MD /std:c++20 /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="-fsanitize=address /EHsc /MD /std:c++latest /permissive- /Zc:char8_t- /Zc:preprocessor /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="-fsanitize=address /EHsc /MD /std:c++latest /permissive- /Zc:noexceptTypes- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="-fsanitize=address /EHsc /MDd /std:c++14 /fp:except /Zc:preprocessor /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="-fsanitize=address /EHsc /MDd /std:c++17 /permissive- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="-fsanitize=address /EHsc /MDd /std:c++20 /permissive- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="-fsanitize=address /EHsc /MDd /std:c++latest /permissive- /Zc:wchar_t- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="-fsanitize=address /EHsc /MDd /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="-fsanitize=address /EHsc /MT /std:c++latest /permissive- /analyze:only /analyze:autolog- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="-fsanitize=address /EHsc /MT /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="-fsanitize=address /EHsc /MTd /std:c++latest /permissive /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="-fsanitize=address /EHsc /MTd /std:c++latest /permissive- /analyze:only /analyze:autolog- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="-fsanitize=address /EHsc /MTd /std:c++latest /permissive- /fp:strict /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="-fsanitize=address /EHsc /MTd /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="-fsanitize=address /Za /EHsc /MD /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="-fsanitize=address /Za /EHsc /MDd /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="/D_ANNOTATE_VECTOR /BE /c /EHsc /MD /std:c++14 /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="/D_ANNOTATE_VECTOR /BE /c /EHsc /MDd /std:c++17 /permissive- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="/D_ANNOTATE_VECTOR /BE /c /EHsc /MT /std:c++20 /permissive- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="/D_ANNOTATE_VECTOR /BE /c /EHsc /MTd /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="/D_ANNOTATE_VECTOR /EHsc /MD /std:c++14 /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="/D_ANNOTATE_VECTOR /EHsc /MD /std:c++17 /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="/D_ANNOTATE_VECTOR /EHsc /MD /std:c++20 /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="/D_ANNOTATE_VECTOR /EHsc /MD /std:c++latest /permissive- /Zc:char8_t- /Zc:preprocessor /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="/D_ANNOTATE_VECTOR /EHsc /MD /std:c++latest /permissive- /Zc:noexceptTypes- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="/D_ANNOTATE_VECTOR /EHsc /MDd /std:c++14 /fp:except /Zc:preprocessor /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="/D_ANNOTATE_VECTOR /EHsc /MDd /std:c++17 /permissive- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="/D_ANNOTATE_VECTOR /EHsc /MDd /std:c++20 /permissive- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="/D_ANNOTATE_VECTOR /EHsc /MDd /std:c++latest /permissive- /Zc:wchar_t- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="/D_ANNOTATE_VECTOR /EHsc /MDd /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="/D_ANNOTATE_VECTOR /EHsc /MT /std:c++latest /permissive- /analyze:only /analyze:autolog- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="/D_ANNOTATE_VECTOR /EHsc /MT /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="/D_ANNOTATE_VECTOR /EHsc /MTd /std:c++latest /permissive /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="/D_ANNOTATE_VECTOR /EHsc /MTd /std:c++latest /permissive- /analyze:only /analyze:autolog- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="/D_ANNOTATE_VECTOR /EHsc /MTd /std:c++latest /permissive- /fp:strict /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="/D_ANNOTATE_VECTOR /EHsc /MTd /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="/D_ANNOTATE_VECTOR /Za /EHsc /MD /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib" | ||
| PM_CL="/D_ANNOTATE_VECTOR /Za /EHsc /MDd /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib" | ||
| # TRANSITION, clang-cl does not support /alternatename so we cannot test /D_ANNOTATE_VECTOR without -fsanitize=address | ||
| PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MD /std:c++14" | ||
| PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MD /std:c++17" | ||
| PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MT /std:c++latest /permissive-" | ||
| PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MT /std:c++latest /permissive- /D_HAS_CXX23 /fp:strict" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.