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

Address Sanitizer support in CoreCLR #74623

Merged
merged 59 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
e0c4a60
Enable AddressSanitizer in CoreCLR, Libs, and Host and update runtime…
jkoritzinsky Mar 16, 2023
6fc2555
Unify on HAS_ADDRESS_SANITIZER define name
jkoritzinsky Mar 17, 2023
d7fe870
Remove CRT runtime changes. We won't need this when we finally onboar…
jkoritzinsky Mar 24, 2023
007da09
Remove suppression now that we've fixed the underlying issue.
jkoritzinsky Mar 27, 2023
8d3615d
Remove some Windows-only sanitizer CMake that we won't need when ASAN…
jkoritzinsky Mar 27, 2023
92c4858
Set schedule for runtime-sanitized pipeline
jkoritzinsky Mar 27, 2023
a1f9900
Remove workaround in JIT memory set/copy helpers now that the JIT bug…
jkoritzinsky Apr 4, 2023
2978de4
Add missing helix queues setup template.
jkoritzinsky Apr 5, 2023
203e70c
Fix missing command to build nativeaot runtime tests as nativeaot.
jkoritzinsky Apr 7, 2023
eb9bf22
Add a scenario name to trigger the extended timeout in the libraries …
jkoritzinsky Apr 7, 2023
413410b
Remove extraneous whitespace.
jkoritzinsky Apr 7, 2023
da30efe
Fix using the cross-targetting ILC when sanitizers are enabled. Also …
jkoritzinsky Apr 7, 2023
b99fab9
Merge branch 'main' of github.com:dotnet/runtime into asan
jkoritzinsky Apr 7, 2023
cd167b3
Disable LSAN on the CustomMain test.
jkoritzinsky Apr 10, 2023
8fcc66f
Disable some tests on sanitized runtimes.
jkoritzinsky Apr 10, 2023
931f444
Copy the sanitizer runtime for OSX NativeAOT runtime tests.
jkoritzinsky Apr 10, 2023
6732866
Merge branch 'main' of github.com:dotnet/runtime into asan
jkoritzinsky Apr 17, 2023
3c7dd54
A little cleanup to try to get the build right now that we are always…
jkoritzinsky Apr 17, 2023
04d2d9f
Fix crossgen-corelib.proj syntax.
jkoritzinsky Apr 18, 2023
97c848f
Merge branch 'main' of github.com:dotnet/runtime into asan
jkoritzinsky Apr 18, 2023
9946108
Fix cross-os dac builds to not include the host architecture in the o…
jkoritzinsky Apr 19, 2023
982e701
Split the debugger components into a separate component and make the …
jkoritzinsky Apr 20, 2023
6239952
Merge branch 'asan' of /mnt/e/source/runtime into asan
jkoritzinsky Apr 20, 2023
6769613
Always write out the host-arch path on Windows and update the cross-d…
jkoritzinsky Apr 21, 2023
35d9bd7
Change to use the dynamic runtime on Windows, as ASAN in VS is moving…
jkoritzinsky Apr 21, 2023
8b19fd3
Merge branch 'asan' of github.com:jkoritzinsky/runtime into asan
jkoritzinsky Apr 21, 2023
5ae90d3
Update docker images to include the sanitizer runtimes in the crossro…
jkoritzinsky Apr 21, 2023
647f73b
Merge branch 'main' of github.com:dotnet/runtime into asan
jkoritzinsky Apr 21, 2023
5873281
Fix explicit image tags
jkoritzinsky Apr 21, 2023
d996328
The unsanitized build should be of the target architecture, not the h…
jkoritzinsky Apr 24, 2023
2e452d4
Merge branch 'main' into asan
jkoritzinsky Apr 25, 2023
2130d7b
Merge branch 'asan' of github.com:jkoritzinsky/runtime into asan
jkoritzinsky Apr 25, 2023
dc26f51
Turn off using the sigaltstack for NativeAOT tests that don't use the…
jkoritzinsky Apr 25, 2023
6cc6ad8
Make sure the shared ASAN runtime is present for the nativeaot/SmokeT…
jkoritzinsky Apr 27, 2023
591093e
Disable crossgen2 tests with sanitizers as they don't get us interest…
jkoritzinsky Apr 28, 2023
d285048
Merge branch 'main' of github.com:dotnet/runtime into asan
jkoritzinsky Apr 28, 2023
7187ff2
Fix custom default options and disable some more crossgen2-based tests.
jkoritzinsky May 1, 2023
6448d19
Simplify lookup of asan runtime on mac and fix copying the shared run…
jkoritzinsky May 3, 2023
113f5b2
Merge branch 'asan' of github.com:jkoritzinsky/runtime into asan
jkoritzinsky May 3, 2023
11cccdf
Disable test that's failing for weird reasons.
jkoritzinsky May 4, 2023
c0357af
Merge branch 'main' of github.com:dotnet/runtime into asan
jkoritzinsky May 4, 2023
133e99b
Fix one more alloc-dealloc mismatch that only started to show up afte…
jkoritzinsky May 4, 2023
b863d6f
Disable the System.Text.Json test suite on sanitized builds as it cau…
jkoritzinsky May 5, 2023
8a51e72
Merge branch 'main' of github.com:dotnet/runtime into asan
jkoritzinsky May 5, 2023
98ed710
Fix test exclusion
jkoritzinsky May 8, 2023
4efdf96
Merge branch 'main' of github.com:dotnet/runtime into asan
jkoritzinsky May 15, 2023
6855c78
Merge branch 'main' of github.com:dotnet/runtime into asan
jkoritzinsky May 19, 2023
db5b069
Merge branch 'main' of github.com:dotnet/runtime into asan
jkoritzinsky Jun 7, 2023
6383866
PR feedback.
jkoritzinsky Jun 7, 2023
0f0fdf5
Merge remote-tracking branch 'dotnet/main' into asan
jkoritzinsky Jun 12, 2023
36a450e
Fix mac build
jkoritzinsky Jun 12, 2023
f6987ed
Merge branch 'main' into asan
jkoritzinsky Jul 13, 2023
619966b
Do review changes
jkoritzinsky Jul 14, 2023
929a042
Add libbootstrapper object files to the platform manifest now that Na…
jkoritzinsky Jul 14, 2023
5913ca4
Disable tests that check size on sanitized builds
jkoritzinsky Jul 14, 2023
b8b3762
Use the built-in `include_guard` option
jkoritzinsky Jul 14, 2023
c2433e5
Merge branch 'main' of github.com:dotnet/runtime into asan
jkoritzinsky Jul 14, 2023
fa15f17
Disable use-after-return checking in ASAN. CoreCLR doesn't do well wi…
jkoritzinsky Jul 17, 2023
757a329
Only pass the no UAR flag on C and CXX with Clang (not AppleClang).
jkoritzinsky Jul 18, 2023
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
Prev Previous commit
Next Next commit
PR feedback.
  • Loading branch information
jkoritzinsky committed Jun 7, 2023
commit 6383866a6dcc1d7dc88c16873335aa84db062d8b
10 changes: 0 additions & 10 deletions docs/workflow/building/libraries/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,6 @@ build.sh -s libs -fsanitize address

When building the repo with any native sanitizers, you should build all native components in the repo with the same set of sanitizers.

### Building the native components with native sanitizers

The libraries native components can be built with native sanitizers like AddressSanitizer to help catch memory safety issues. To build the project with native sanitizers, add the `-fsanitize` argument to the build script like the following:

```bash
build.sh -s libs -fsanitize address
```

When building the repo with any native sanitizers, you should build all native components in the repo with the same set of sanitizers.

### How to build native components only

The libraries build contains some native code. This includes shims over libc, openssl, gssapi, and zlib. The build system uses CMake to generate Makefiles using clang. The build also uses git for generating some version information.
Expand Down
14 changes: 10 additions & 4 deletions eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,10 @@
Category="clr" />
</ItemGroup>

<!-- Build the CoreCLR cross tools when we're doing a cross build and either we're building any CoreCLR native tools for platforms CoreCLR fully supports or when someone explicitly requests them -->
<!--
Build the CoreCLR cross tools when we're doing a cross build and either we're building any CoreCLR native tools for platforms CoreCLR fully supports or when someone explicitly requests them.
The cross tools are used as part of the build process with the downloaded build tools, so we need to build them for the host architecture and build them as unsanitized binaries.
-->
<ItemGroup Condition="(('$(ClrRuntimeBuildSubsets)' != '' and '$(PrimaryRuntimeFlavor)' == 'CoreCLR' and '$(TargetsMobile)' != 'true') or $(_subset.Contains('+clr.crossarchtools+'))) and ('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or '$(EnableNativeSanitizers)' != '')">
<ProjectToBuild
Include="$(CoreClrProjectRoot)runtime.proj"
Expand All @@ -268,7 +271,10 @@
Category="clr" />
</ItemGroup>

<!-- Build the debugging components of CoreCLR for the same target architecture as an unsanitized build whenever we build a sanitized coreclr build. -->
<!--
Build the debugging components of CoreCLR for the same target architecture as an unsanitized build whenever we build a sanitized coreclr build.
These components are loaded into a debugger process, which generally is not a sanitized executable.
-->
<ItemGroup Condition="'$(ClrRuntimeBuildSubsets)' != '' and '$(EnableNativeSanitizers)' != ''">
<ProjectToBuild
Include="$(CoreClrProjectRoot)runtime.proj"
Expand Down Expand Up @@ -300,7 +306,7 @@
PgoInstrument=false;
NoPgoOptimize=true;
TargetOS=linux;
CMakeArgs=$(CMakeArgs) -DCLR_CROSS_COMPONENTS_BUILD=1 -DBUILD_DEBUGGER_CROSS_COMPONENTS=1" Category="clr" />
CMakeArgs=$(CMakeArgs) -DCLR_CROSS_COMPONENTS_BUILD=1" Category="clr" />
</ItemGroup>

<ItemGroup Condition="$(_subset.Contains('+alpinedac+')) and $([MSBuild]::IsOsPlatform(Windows)) and '$(TargetArchitecture)' != 'x86'">
Expand All @@ -312,7 +318,7 @@
PgoInstrument=false;
NoPgoOptimize=true;
TargetOS=alpine;
CMakeArgs=$(CMakeArgs) -DCLR_CROSS_COMPONENTS_BUILD=1 -DBUILD_DEBUGGER_CROSS_COMPONENTS=1" Category="clr" />
CMakeArgs=$(CMakeArgs) -DCLR_CROSS_COMPONENTS_BUILD=1" Category="clr" />
</ItemGroup>

<ItemGroup Condition="$(_subset.Contains('+crossdacpack+'))">
Expand Down