Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
SanitizerSetup.cxx
Go to the documentation of this file.
1// Author: Stephan Hageboeck, CERN 2 Mar 2020
2
3/*************************************************************************
4 * Copyright (C) 1995-2020, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11extern "C" {
12
13/// Default options when address sanitizer starts up in ROOT executables.
14/// This is relevant when ROOT's build option `asan` is on.
15/// These can be overridden / augmented by the ASAN_OPTIONS environment variable.
16/// Using ASAN_OPTIONS=help=1 and starting an instrumented ROOT executable, available options will be printed.
17const char* __asan_default_options() {
18
19#ifdef ASAN_DETECT_LEAKS
20#define DETECT_LEAKS ":detect_leaks=1"
21#else
22#define DETECT_LEAKS ":detect_leaks=0"
23#endif
24
25 // TODO: Re-enable check_initialization_order=1, currently finds a false
26 // positive in llvm::DataLayout::reset accessing DefaultAlignments while
27 // loading the Net library.
28
29 return "strict_string_checks=1"
30 ":detect_stack_use_after_return=1"
31 ":detect_container_overflow=1"
32 ":alloc_dealloc_mismatch=0"
34 ":verify_asan_link_order=0";
35}
36
37/// Default options when leak sanitizer starts up in ROOT executables.
38/// This is relevant when ROOT's build options `asan` is on.
39/// These can be overridden / augmented by the LSAN_OPTIONS environment variable.
40/// Using LSAN_OPTIONS=help=1 and starting an instrumented ROOT executable, available options will be printed.
42 return "max_leaks=10:print_suppressions=1";
43}
44
45/// Default suppressions for leak sanitizer in ROOT.
46/// Since llvm uses allocators that do not give back memory, many leaks would show up.
47/// A customisable version can be found in `$ROOTSYS/build/`.
49 return "leak:llvm::SmallVectorBase::grow_pod \n"
50 "leak:llvm::BumpPtrAllocatorImpl \n"
51 "leak:llvm::DenseMap*grow \n"
52 "leak:llvm::StringMapImpl \n"
53 "leak:llvm::TinyPtr \n"
54 "leak:llvm::FoldingSetBase \n"
55 "leak:llvm::MemoryBuffer \n"
56 "leak:llvm::CodeGenDAG \n"
57 "leak:llvm::EmitFastISel \n"
58 "leak:llvm-tblgen \n"
59 "leak:clang::FileManager::getFile \n" // clang
60 "leak:clang::LineTableInfo \n"
61 "leak:clang::HeaderSearch \n"
62 "leak:clang::Diag \n"
63 "leak:clang::Preprocessor:: \n"
64 "leak:clang::TextDiagnosticPrinter \n"
65 "leak:clang-tblgen \n"
66 "leak:cling::IncrementalExecutor\n" //cling macro execution
67 "leak:bin/rootcint\n" // direct calls into non-sanitised libstdc++
68 "leak:bin/rootcling\n" // direct calls into non-sanitised libstdc++
69 "leak:bin/bash\n"; // When python imports ROOT
70}
71
72}
const char * __lsan_default_suppressions()
Default suppressions for leak sanitizer in ROOT.
#define DETECT_LEAKS
const char * __asan_default_options()
Default options when address sanitizer starts up in ROOT executables.
const char * __lsan_default_options()
Default options when leak sanitizer starts up in ROOT executables.