[cfe-dev] clang attributes to disable asan/tsan/msan

Kostya Serebryany kcc at google.com
Mon Feb 18 05:31:24 PST 2013


Hi,

Clang has two attributes to disable bug detection tools in a given
function:

__attribute__((no_thread_safety_analysis)) disables clang's *static*
thread-safety analysis. (
http://clang.llvm.org/docs/LanguageExtensions.html#thread-safety-annotation-checking
)

__attribute__((no_address_safety_analysis)) disables AddressSanitizer
(*dynamic* analysis)
http://clang.llvm.org/docs/LanguageExtensions.html#extensions-for-dynamic-analysis

Now we need two more attributes to disable
ThreadSanitizer (http://clang.llvm.org/docs/ThreadSanitizer.html)
and MemorySanitizer (http://clang.llvm.org/docs/MemorySanitizer.html)

For MemorySanitizer I propose __attribute__((no_uninitialized_checks))
Objections? Better naming suggestion?
Maybe __attribute__((no_memory_sanitizer))?
(We deliberately named no-asan attribute "no_address_safety_analysis" w/o
mentioning asan
in the name to make this attribute usable for other tools, e.g. SAFECode.
So,
we may not want to tie the no-msan attribute to msan)

For ThreadSanitizer the question is a bit trickier.
We can reuse __attribute__((no_thread_safety_analysis)) which makes sense
because it already means a similar thing.

OTOH, most of the current uses of no_thread_safety_analysis I know about
are there because of the limitations of clang's static analysis.
And we don't need to disable ThreadSanitizer for the majority of those
cases,
which means we may better use another attribute to disable ThreadSanitizer
checking.
How to name it?
__attribute__((no_thread_sanitizer))?
__attribute__((no_dynamic_thread_safety_analysis))?
__attribute__((thread_sanitizer_ignore_plain_memory_accesses))?

The patch discussion: http://llvm-reviews.chandlerc.com/D390

Thanks,

--kcc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130218/9052e401/attachment.html>


More information about the cfe-dev mailing list