<div dir="ltr">Should be done in r212643.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 8, 2014 at 9:56 AM, Alexey Samsonov <span dir="ltr"><<a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">SpecialCaseList is still used in DFSan instrumentation pass. However, I definitely would work on turning blacklist into a Clang class - we should blacklist items based on the source information instead of using llvm::Function name or llvm::Module module identifier. More changes to go.</div>

<div class="gmail_extra"><div><div class="h5"><br><br><div class="gmail_quote">On Tue, Jul 8, 2014 at 1:19 AM, Benjamin Kramer <span dir="ltr"><<a href="mailto:benny.kra@gmail.com" target="_blank">benny.kra@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On Tue, Jul 8, 2014 at 2:50 AM, Alexey Samsonov <<a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a>> wrote:<br>


> Author: samsonov<br>
> Date: Mon Jul  7 19:50:49 2014<br>
> New Revision: 212505<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=212505&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=212505&view=rev</a><br>
> Log:<br>
> [ASan] Completely remove sanitizer blacklist file from instrumentation pass.<br>
<br>
</div>Can SpecialCaseList now move to Clang? It's a bit strange to have a<br>
dependency from clangDriver to LLVMTransformUtils.<br>
<br>
- Ben<br>
<div><div><br>
><br>
> All blacklisting logic is now moved to the frontend (Clang).<br>
> If a function (or source file it is in) is blacklisted, it doesn't<br>
> get sanitize_address attribute and is therefore not instrumented.<br>
> If a global variable (or source file it is in) is blacklisted, it is<br>
> reported to be blacklisted by the entry in llvm.asan.globals metadata,<br>
> and is not modified by the instrumentation.<br>
><br>
> The latter may lead to certain false positives - not all the globals<br>
> created by Clang are described in llvm.asan.globals metadata (e.g,<br>
> RTTI descriptors are not), so we may start reporting errors on them<br>
> even if "module" they appear in is blacklisted. We assume it's fine<br>
> to take such risk:<br>
>   1) errors on these globals are rare and usually indicate wild memory access<br>
>   2) we can lazily add descriptors for these globals into llvm.asan.globals<br>
>      lazily.<br>
><br>
><br>
> Modified:<br>
>     llvm/trunk/include/llvm/Transforms/Instrumentation.h<br>
>     llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp<br>
><br>
> Modified: llvm/trunk/include/llvm/Transforms/Instrumentation.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Instrumentation.h?rev=212505&r1=212504&r2=212505&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Instrumentation.h?rev=212505&r1=212504&r2=212505&view=diff</a><br>


> ==============================================================================<br>
> --- llvm/trunk/include/llvm/Transforms/Instrumentation.h (original)<br>
> +++ llvm/trunk/include/llvm/Transforms/Instrumentation.h Mon Jul  7 19:50:49 2014<br>
> @@ -65,8 +65,7 @@ ModulePass *createGCOVProfilerPass(const<br>
><br>
>  // Insert AddressSanitizer (address sanity checking) instrumentation<br>
>  FunctionPass *createAddressSanitizerFunctionPass();<br>
> -ModulePass *<br>
> -createAddressSanitizerModulePass(StringRef BlacklistFile = StringRef());<br>
> +ModulePass *createAddressSanitizerModulePass();<br>
><br>
>  // Insert MemorySanitizer instrumentation (detection of uninitialized reads)<br>
>  FunctionPass *createMemorySanitizerPass(int TrackOrigins = 0);<br>
><br>
> Modified: llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp?rev=212505&r1=212504&r2=212505&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp?rev=212505&r1=212504&r2=212505&view=diff</a><br>


> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp Mon Jul  7 19:50:49 2014<br>
> @@ -45,7 +45,6 @@<br>
>  #include "llvm/Transforms/Utils/Cloning.h"<br>
>  #include "llvm/Transforms/Utils/Local.h"<br>
>  #include "llvm/Transforms/Utils/ModuleUtils.h"<br>
> -#include "llvm/Transforms/Utils/SpecialCaseList.h"<br>
>  #include <algorithm><br>
>  #include <string><br>
>  #include <system_error><br>
> @@ -149,9 +148,6 @@ static cl::opt<bool> ClInvalidPointerPai<br>
>  static cl::opt<unsigned> ClRealignStack("asan-realign-stack",<br>
>         cl::desc("Realign stack to the value of this flag (power of two)"),<br>
>         cl::Hidden, cl::init(32));<br>
> -static cl::opt<std::string> ClBlacklistFile("asan-blacklist",<br>
> -       cl::desc("File containing the list of objects to ignore "<br>
> -                "during instrumentation"), cl::Hidden);<br>
>  static cl::opt<int> ClInstrumentationWithCallsThreshold(<br>
>      "asan-instrumentation-with-call-threshold",<br>
>         cl::desc("If the function being instrumented contains more than "<br>
> @@ -418,9 +414,7 @@ struct AddressSanitizer : public Functio<br>
><br>
>  class AddressSanitizerModule : public ModulePass {<br>
>   public:<br>
> -  AddressSanitizerModule(StringRef BlacklistFile = StringRef())<br>
> -      : ModulePass(ID), BlacklistFile(BlacklistFile.empty() ? ClBlacklistFile<br>
> -                                                            : BlacklistFile) {}<br>
> +  AddressSanitizerModule() : ModulePass(ID) {}<br>
>    bool runOnModule(Module &M) override;<br>
>    static char ID;  // Pass identification, replacement for typeid<br>
>    const char *getPassName() const override {<br>
> @@ -438,9 +432,6 @@ class AddressSanitizerModule : public Mo<br>
>      return RedzoneSizeForScale(Mapping.Scale);<br>
>    }<br>
><br>
> -  SmallString<64> BlacklistFile;<br>
> -<br>
> -  std::unique_ptr<SpecialCaseList> BL;<br>
>    GlobalsMetadata GlobalsMD;<br>
>    Type *IntptrTy;<br>
>    LLVMContext *C;<br>
> @@ -601,8 +592,8 @@ char AddressSanitizerModule::ID = 0;<br>
>  INITIALIZE_PASS(AddressSanitizerModule, "asan-module",<br>
>      "AddressSanitizer: detects use-after-free and out-of-bounds bugs."<br>
>      "ModulePass", false, false)<br>
> -ModulePass *llvm::createAddressSanitizerModulePass(StringRef BlacklistFile) {<br>
> -  return new AddressSanitizerModule(BlacklistFile);<br>
> +ModulePass *llvm::createAddressSanitizerModulePass() {<br>
> +  return new AddressSanitizerModule();<br>
>  }<br>
><br>
>  static size_t TypeSizeToSizeIndex(uint32_t TypeSize) {<br>
> @@ -926,9 +917,6 @@ bool AddressSanitizerModule::ShouldInstr<br>
>    Type *Ty = cast<PointerType>(G->getType())->getElementType();<br>
>    DEBUG(dbgs() << "GLOBAL: " << *G << "\n");<br>
><br>
> -  // FIXME: Don't use the blacklist here, all the data should be collected<br>
> -  // by the frontend and passed in globals metadata.<br>
> -  if (BL->isIn(*G)) return false;<br>
>    if (GlobalsMD.isBlacklisted(G)) return false;<br>
>    if (GlobalsMD.isSourceLocationGlobal(G)) return false;<br>
>    if (!Ty->isSized()) return false;<br>
> @@ -1163,7 +1151,6 @@ bool AddressSanitizerModule::runOnModule<br>
>    if (!DLP)<br>
>      return false;<br>
>    DL = &DLP->getDataLayout();<br>
> -  BL.reset(SpecialCaseList::createOrDie(BlacklistFile));<br>
>    C = &(M.getContext());<br>
>    int LongSize = DL->getPointerSizeInBits();<br>
>    IntptrTy = Type::getIntNTy(*C, LongSize);<br>
> @@ -1183,7 +1170,8 @@ bool AddressSanitizerModule::runOnModule<br>
>      Changed = true;<br>
>    }<br>
><br>
> -  if (ClGlobals && !BL->isIn(M)) Changed |= InstrumentGlobals(IRB, M);<br>
> +  if (ClGlobals)<br>
> +    Changed |= InstrumentGlobals(IRB, M);<br>
><br>
>    return Changed;<br>
>  }<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br><div dir="ltr">Alexey Samsonov<br><a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a></div>

</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Alexey Samsonov<br><a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a></div>
</div>