[clang] [compiler-rt] [ASan] Document define to disable container overflow checks at compile time. (PR #163468)

Thurston Dang via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 14 18:09:15 PDT 2025


================
@@ -164,6 +164,23 @@ To summarize: ``-fsanitize-address-use-after-return=<mode>``
   * ``always``: Enables detection of UAR errors in all cases. (reduces code
     size, but not as much as ``never``).
 
+Container Overflow Detection
+----------------------------
+
+AddressSanitizer can detect overflows in containers with custom allocators
+(such as std::vector) where the Library developers have added calls into the
+AddressSanitizer runtime to indicate which memory is poisoned etc.
+
+In environments where not all the process binaries can be recompiled with 
+AddressSanitizer enabled, these checks can cause false positives.
+
+These checks can be disabled at runtime using
+``ASAN_OPTIONS=detect_container_overflow=0``
+
+``-D__ASAN_DISABLE_CONTAINER_OVERFLOW__`` can be used at compile time to
+disable container overflow checks if the container library has added support
+for this define.
+
----------------
thurstond wrote:

I suggest moving these suppression methods into the "Disabling container overflow checks" section (or nearby), and have one sentence here instead to refer to the section below.

https://github.com/llvm/llvm-project/pull/163468


More information about the cfe-commits mailing list