[clang] [compiler-rt] [ASan] Document define to disable container overflow checks at compile time. (PR #163468)
Dan Blackwell via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 23 07:37:02 PDT 2025
================
@@ -242,6 +255,43 @@ AddressSanitizer also supports
works similar to ``__attribute__((no_sanitize("address")))``, but it also
prevents instrumentation performed by other sanitizers.
+Disabling container overflow checks
+-----------------------------------
+
+Runtime suppression
+^^^^^^^^^^^^^^^^^^^
+
+Container overflow checks can be disabled at runtime using
+``ASAN_OPTIONS=detect_container_overflow=0``
+
+Compile time suppression
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+``-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.
----------------
DanBlackwell wrote:
I think I get it, @vitalybuka @fmayer @thurstond is this what you are proposing: https://github.com/DanBlackwell/llvm-project/commit/fcdb4c2d6921764a80a90840e9eb40f4f97a6de7 ? e.g.
```
void SANITIZER_CDECL __sanitizer_annotate_contiguous_container(
const void *beg, const void *end, const void *old_mid, const void *new_mid)
#ifdef __ASAN_DISABLE_CONTAINER_OVERFLOW__
{} // no-op implementation (disabling checks)
#else
; // function declaration, runtime implementation
#endif
```
https://github.com/llvm/llvm-project/pull/163468
More information about the llvm-commits
mailing list