May 27th, 2025

Address Sanitizer Updates for Visual Studio 2022 Version 17.14

Introduction

It has been an exciting few months for the Address Sanitizer (ASan) since our last update. In addition to our continuous focus on quality and correctness, our internal “dogfooding” (i.e. internal adoption) effort has reached several important milestones.

In this update, I want to go over some of the quality improvements since Visual Studio 2022 version 17.13, and to give a peek into how ASan is now protecting our C++ toolset against memory safety errors during development.

Some improvements in Visual Studio 2022 version 17.14

  • We increased the number of ASan flags that can be set through __asan_default_options, the alternative to the environment variable ASAN_OPTIONS. This was an adoption blocker for apps that, for security reasons, can’t access the environment during execution.
  • For Xbox developers, we now have automated testing ensuring that ASan’s dependencies are compatible with the Xbox OS. This is important since we now integrate changes from upstream LLVM on a weekly basis, meaning that we need to actively guard against Xbox-incompatible changes.
  • We fixed a regression that corrupted the callstack displayed during error reporting in x64.
  • Improved stability by removing the lazy loading of DbgHelp symbolization helpers, minimizing loader lock contention.
  • In the STL, we now allow ASan container annotations to be disabled on a per-allocator basis. This allows users to control container poisoning, which is useful when custom allocators (e.g. arenas) are in use.

This release also contains several other improvements, many of which were contributed by the ASan open-source community in the LLVM repo. By contributing to LLVM upstream, you are also contributing to MSVC’s ASan. We thank the entire LLVM ASan community for their efforts, and plan to continue contributing our improvements upstream as well.

Protecting the C++ toolchain

To protect the toolchain against memory safety errors, all PRs made against the MSVC toolset and libraries now need to pass ASan instrumentation tests. These are tests where the compiler itself is instrumented with ASan to catch memory safety violations while executing our compiler test suite.

To be clear, this is different from compiling test programs with ASan, i.e. having the compiler run /fsanitize=address on some .cpp file. Instead, the compiler itself is built with /fsanitize=address before executing its test matrix so that ASan may monitor allocations during compilation.

Through this process, we have learned a lot about how to adopt ASan in a large and historied codebase like MSVC and it’s helped us drive several improvements in both the toolset as well as in ASan itself, so we’re excited about the quality improvement cycle that dogfooding ASan within MSVC unlocks for us.

Let’s harden our C++ code together!

The ASan team is proud to help you secure your C++ applications, and we would love to hear from you. If you’re not using it already, download Visual Studio and give the Address Sanitizer a try. We can be reached out through the comments below and through our official support channels: Developer Community or through Visual Studio by clicking Help > Send Feedback > Report A Problem / Provide a suggestion in the product.

Until next time!

Author

5 comments