Lines Matching full:asan

94 #define DEBUG_TYPE "asan"
131 const char kAsanModuleCtorName[] = "asan.module_ctor";
132 const char kAsanModuleDtorName[] = "asan.module_dtor";
163 // ASan version script has __asan_* wildcard. Triple underscore prevents a
197 "asan-kernel", cl::desc("Enable KernelAddressSanitizer instrumentation"),
201 "asan-recover",
206 "asan-guard-against-version-mismatch",
210 // This flag may need to be replaced with -f[no-]asan-reads.
211 static cl::opt<bool> ClInstrumentReads("asan-instrument-reads",
216 "asan-instrument-writes", cl::desc("instrument write instructions"),
220 ClUseStackSafety("asan-use-stack-safety", cl::Hidden, cl::init(true),
225 "asan-instrument-atomics",
230 ClInstrumentByval("asan-instrument-byval",
235 "asan-always-slow-path",
240 "asan-force-dynamic-shadow",
245 ClWithIfunc("asan-with-ifunc",
251 "asan-with-ifunc-suppress-remat",
261 "asan-max-ins-per-bb", cl::init(10000),
265 // This flag may need to be replaced with -f[no]asan-stack.
266 static cl::opt<bool> ClStack("asan-stack", cl::desc("Handle stack memory"),
269 "asan-max-inline-poisoning-size",
275 "asan-use-after-return",
288 static cl::opt<bool> ClRedzoneByvalArgs("asan-redzone-byval-args",
294 static cl::opt<bool> ClUseAfterScope("asan-use-after-scope",
298 // This flag may need to be replaced with -f[no]asan-globals.
299 static cl::opt<bool> ClGlobals("asan-globals",
303 static cl::opt<bool> ClInitializers("asan-initialization-order",
308 "asan-detect-invalid-pointer-pair",
313 "asan-detect-invalid-pointer-cmp",
318 "asan-detect-invalid-pointer-sub",
323 "asan-realign-stack",
328 "asan-instrumentation-with-call-threshold",
335 "asan-memory-access-callback-prefix",
340 "asan-kernel-mem-intrinsic-prefix",
345 ClInstrumentDynamicAllocas("asan-instrument-dynamic-allocas",
350 "asan-skip-promotable-allocas",
355 "asan-constructor-kind",
356 cl::desc("Sets the ASan constructor kind"),
365 static cl::opt<int> ClMappingScale("asan-mapping-scale",
366 cl::desc("scale of asan shadow mapping"),
370 ClMappingOffset("asan-mapping-offset",
371 cl::desc("offset of asan shadow mapping [EXPERIMENTAL]"),
377 static cl::opt<bool> ClOpt("asan-opt", cl::desc("Optimize instrumentation"),
380 static cl::opt<bool> ClOptimizeCallbacks("asan-optimize-callbacks",
385 "asan-opt-same-temp", cl::desc("Instrument the same temp just once"),
388 static cl::opt<bool> ClOptGlobals("asan-opt-globals",
393 "asan-opt-stack", cl::desc("Don't instrument scalar stack variables"),
397 "asan-stack-dynamic-alloca",
402 "asan-force-experiment",
407 ClUsePrivateAlias("asan-use-private-alias",
412 ClUseOdrIndicator("asan-use-odr-indicator",
417 ClUseGlobalsGC("asan-globals-live-support",
425 ClWithComdat("asan-with-comdat",
426 cl::desc("Place ASan constructors in comdat sections"),
430 "asan-destructor-kind",
431 cl::desc("Sets the ASan destructor kind. The default is to use the value "
440 static cl::opt<int> ClDebug("asan-debug", cl::desc("debug"), cl::Hidden,
443 static cl::opt<int> ClDebugStack("asan-debug-stack", cl::desc("debug stack"),
446 static cl::opt<std::string> ClDebugFunc("asan-debug-func", cl::Hidden,
449 static cl::opt<int> ClDebugMin("asan-debug-min", cl::desc("Debug min inst"),
452 static cl::opt<int> ClDebugMax("asan-debug-max", cl::desc("Debug max inst"),
646 /// Helper RAII class to post-process inserted asan runtime calls during a
982 // This causes asan to report a non-existing bug on 453.povray.
986 AddressSanitizer &ASan; member
1024 FunctionStackPoisoner(Function &F, AddressSanitizer &ASan, in FunctionStackPoisoner()
1026 : F(F), ASan(ASan), RTCI(RTCI), in FunctionStackPoisoner()
1027 DIB(*F.getParent(), /*AllowUnresolved*/ false), C(ASan.C), in FunctionStackPoisoner()
1028 IntptrTy(ASan.IntptrTy), IntptrPtrTy(PointerType::get(IntptrTy, 0)), in FunctionStackPoisoner()
1029 Mapping(ASan.Mapping), in FunctionStackPoisoner()
1144 if (!ASan.isInterestingAlloca(AI) || isa<ScalableVectorType>(AllocaType) || in visitAllocaInst()
1169 if (!ASan.UseAfterScope) in visitIntrinsicInst()
1173 // Found lifetime intrinsic, add ASan instrumentation if necessary. in visitIntrinsicInst()
1192 if (!ASan.isInterestingAlloca(*AI)) in visitIntrinsicInst()
1204 HasInlineAsm |= CI->isInlineAsm() && &CB != ASan.LocalDynamicShadow; in visitCallBase()
1297 // Do not instrument asan globals. in GlobalWasGeneratedByCompiler()
1823 Trm->getParent()->setName("asan.report"); in genAMDGPUReportBlock()
1990 // Don't instrument CTORs that will run before asan.module_ctor. in createInitializerPoisonCalls()
2181 case Triple::COFF: return ".ASAN$GL"; in getGlobalMetadataSection()
2264 // Create a separate metadata global and put it in the appropriate ASan
2492 // asan constructor is comdat-compatible.
2894 IRB.CreateCall(Asm, {AsanShadowGlobal}, ".asan.shadow"); in maybeInsertDynamicShadowAtFunctionEntry()
2897 IRB.CreatePointerCast(AsanShadowGlobal, IntptrTy, ".asan.shadow"); in maybeInsertDynamicShadowAtFunctionEntry()
2967 LLVM_DEBUG(dbgs() << "ASAN instrumenting:\n" << F << "\n"); in instrumentFunction()
3084 LLVM_DEBUG(dbgs() << "ASAN done instrumenting: " << FunctionModified << " " in instrumentFunction()
3105 if (ASan.UseAfterReturn == AsanDetectStackUseAfterReturnMode::Always || in initializeCallbacks()
3106 ASan.UseAfterReturn == AsanDetectStackUseAfterReturnMode::Runtime) { in initializeCallbacks()
3108 ASan.UseAfterReturn == AsanDetectStackUseAfterReturnMode::Always in initializeCallbacks()
3120 if (ASan.UseAfterScope) { in initializeCallbacks()
3151 std::min<size_t>(sizeof(uint64_t), ASan.LongSize / 8); in copyToShadowInline()
3220 if (j - i >= ASan.MaxInlinePoisoningSize) { in copyToShadow()
3245 if (CopyInsertPoint == ASan.LocalDynamicShadow) { in copyArgsPassedByValToAllocas()
3319 assert(ASan.isInterestingAlloca(*APC.AI)); in processDynamicAllocas()
3342 AddressSanitizer &ASan, Instruction &InsBefore, in findStoresToUninstrumentedArgAllocas() argument
3359 // ASan to instrument. These are moved up before InsBefore, and they're in findStoresToUninstrumentedArgAllocas()
3362 if (!Alloca || ASan.isInterestingAlloca(*Alloca)) in findStoresToUninstrumentedArgAllocas()
3418 findStoresToUninstrumentedArgAllocas(ASan, *InsBefore, ArgInitInsts); in processStaticAllocas()
3429 ASan.getAllocaSizeInBytes(*AI), in processStaticAllocas()
3441 uint64_t MinHeaderSize = std::max((uint64_t)ASan.LongSize / 2, Granularity); in processStaticAllocas()
3454 assert(ASan.isInterestingAlloca(*APC.AI)); in processStaticAllocas()
3472 ASan.UseAfterReturn != AsanDetectStackUseAfterReturnMode::Never && in processStaticAllocas()
3473 !ASan.CompileKernel && LocalStackSize <= kMaxStackMallocSize; in processStaticAllocas()
3495 if (ASan.UseAfterReturn == AsanDetectStackUseAfterReturnMode::Runtime) { in processStaticAllocas()
3518 // assert(ASan.UseAfterReturn == AsanDetectStackUseAfterReturnMode:Always) in processStaticAllocas()
3556 "Variable descriptions relative to ASan stack base will be dropped"); in processStaticAllocas()
3577 ConstantInt::get(IntptrTy, ASan.LongSize / 8)), in processStaticAllocas()
3587 ConstantInt::get(IntptrTy, 2 * ASan.LongSize / 8)), in processStaticAllocas()
3594 Value *ShadowBase = ASan.memToShadow(LocalStackBase, IRB); in processStaticAllocas()
3643 if (ASan.MaxInlinePoisoningSize != 0 && StackMallocIdx <= 4) { in processStaticAllocas()
3651 ConstantInt::get(IntptrTy, ClassSize - ASan.LongSize / 8)); in processStaticAllocas()
3678 // For now just insert the call to ASan runtime. in poisonAlloca()