================
@@ -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.
----------------
padriff wrote:

Just adding the simple no implementation body will lead to linkers complaining 
about multiple definitions in the build.

I added two new test files in the PR to demonstrates the issue and what I think 
are the approaches that could work in the sanitizer headers:

stack_container_dynamic_lib.cpp uses the approach that library providers do the 
work to remove the container overflow instrumentation

stack_container_dynamic_lib_redef.cpp shows three alternate approaches to 
providing the solution in the santizer headers when
__ASAN_DISABLE_CONTAINER_OVERFLOW__ is defined:
 - provide an alternate empty body that is force inlined
 - provide an alternate empty body that is declared with static linkage
 - use a #define to remove the calls from the library sources
 
The _redef test shows that we can do this with minimal changes to something 
like libcpp - they would just need to use the sanitizer interface headers 
rather than declaring the functions themselves

https://github.com/llvm/llvm-project/pull/163468
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to