================
@@ -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:
Is there anything stopping libcxx from using the
[header](https://github.com/llvm/llvm-project/blob/main/compiler-rt/include/sanitizer/common_interface_defs.h)?
(I presume you can just guard it in `#if __has_feature(address_sanitizer)`) If
not then I like the idea of having the functions static and no-ops if the macro
is defined, i.e.
```
#ifdef __ASAN_DISABLE_CONTAINER_OVERFLOW__
static void SANITIZER_CDECL __sanitizer_maybe_annotate_contiguous_container(
const void *beg, const void *end, const void *old_mid, const void *new_mid)
{ // no-op }
#else
void SANITIZER_CDECL __sanitizer_maybe_annotate_contiguous_container(
const void *beg, const void *end, const void *old_mid, const void
*new_mid); // forward declare for runtime
#endif
}
```
The header has an `ifndef SANITIZER_COMMON_INTERFACE_DEFS_H` guard, so you
wouldn't get multiple definitions even if you include it multiple times, e.g.:
```
#include <vector>
#include <deque>
```
That being said I may be missing something wrt linking and ODR here.
https://github.com/llvm/llvm-project/pull/163468
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits