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

Jean-Daniel Dupas devlists at shadowlab.org
Mon Feb 18 05:45:20 PST 2013

Le 18 févr. 2013 à 14:31, Kostya Serebryany <kcc at google.com> a écrit :

> 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))

Just a though, but instead of creating new attribute for each analyze, wouldn't it be possible to define a single parameterized attribute which would take parameters similar to the one passed to the --sanitize option ?

__attribute__((safety_analysis("memory", "thread", …)))

-- Jean-Daniel

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

More information about the cfe-dev mailing list