|
LLVM
10.0.0
|
#include "llvm/Transforms/Instrumentation/AddressSanitizer.h"#include "llvm/ADT/ArrayRef.h"#include "llvm/ADT/DenseMap.h"#include "llvm/ADT/DepthFirstIterator.h"#include "llvm/ADT/SmallPtrSet.h"#include "llvm/ADT/SmallVector.h"#include "llvm/ADT/Statistic.h"#include "llvm/ADT/StringExtras.h"#include "llvm/ADT/StringRef.h"#include "llvm/ADT/Triple.h"#include "llvm/ADT/Twine.h"#include "llvm/Analysis/MemoryBuiltins.h"#include "llvm/Analysis/TargetLibraryInfo.h"#include "llvm/Analysis/ValueTracking.h"#include "llvm/BinaryFormat/MachO.h"#include "llvm/IR/Argument.h"#include "llvm/IR/Attributes.h"#include "llvm/IR/BasicBlock.h"#include "llvm/IR/CallSite.h"#include "llvm/IR/Comdat.h"#include "llvm/IR/Constant.h"#include "llvm/IR/Constants.h"#include "llvm/IR/DIBuilder.h"#include "llvm/IR/DataLayout.h"#include "llvm/IR/DebugInfoMetadata.h"#include "llvm/IR/DebugLoc.h"#include "llvm/IR/DerivedTypes.h"#include "llvm/IR/Dominators.h"#include "llvm/IR/Function.h"#include "llvm/IR/GlobalAlias.h"#include "llvm/IR/GlobalValue.h"#include "llvm/IR/GlobalVariable.h"#include "llvm/IR/IRBuilder.h"#include "llvm/IR/InlineAsm.h"#include "llvm/IR/InstVisitor.h"#include "llvm/IR/InstrTypes.h"#include "llvm/IR/Instruction.h"#include "llvm/IR/Instructions.h"#include "llvm/IR/IntrinsicInst.h"#include "llvm/IR/Intrinsics.h"#include "llvm/IR/LLVMContext.h"#include "llvm/IR/MDBuilder.h"#include "llvm/IR/Metadata.h"#include "llvm/IR/Module.h"#include "llvm/IR/Type.h"#include "llvm/IR/Use.h"#include "llvm/IR/Value.h"#include "llvm/InitializePasses.h"#include "llvm/MC/MCSectionMachO.h"#include "llvm/Pass.h"#include "llvm/Support/Casting.h"#include "llvm/Support/CommandLine.h"#include "llvm/Support/Debug.h"#include "llvm/Support/ErrorHandling.h"#include "llvm/Support/MathExtras.h"#include "llvm/Support/ScopedPrinter.h"#include "llvm/Support/raw_ostream.h"#include "llvm/Transforms/Instrumentation.h"#include "llvm/Transforms/Utils/ASanStackFrameLayout.h"#include "llvm/Transforms/Utils/BasicBlockUtils.h"#include "llvm/Transforms/Utils/Local.h"#include "llvm/Transforms/Utils/ModuleUtils.h"#include "llvm/Transforms/Utils/PromoteMemToReg.h"#include <algorithm>#include <cassert>#include <cstddef>#include <cstdint>#include <iomanip>#include <limits>#include <memory>#include <sstream>#include <string>#include <tuple>Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "asan" |
Functions | |
| STATISTIC (NumInstrumentedReads, "Number of instrumented reads") | |
| STATISTIC (NumInstrumentedWrites, "Number of instrumented writes") | |
| STATISTIC (NumOptimizedAccessesToGlobalVar, "Number of optimized accesses to global vars") | |
| STATISTIC (NumOptimizedAccessesToStackVar, "Number of optimized accesses to stack vars") | |
| static ShadowMapping | getShadowMapping (Triple &TargetTriple, int LongSize, bool IsKasan) |
| static size_t | RedzoneSizeForScale (int MappingScale) |
| static uint64_t | GetCtorAndDtorPriority (Triple &TargetTriple) |
| INITIALIZE_PASS(ASanGlobalsMetadataWrapperPass, "asan-globals-md", "Read metadata to mark which globals should be instrumented " "when running ASan.", false, true) char AddressSanitizerLegacyPass | INITIALIZE_PASS_BEGIN (AddressSanitizerLegacyPass, "asan", "AddressSanitizer: detects use-after-free and out-of-bounds bugs.", false, false) INITIALIZE_PASS_END(AddressSanitizerLegacyPass |
| INITIALIZE_PASS (ModuleAddressSanitizerLegacyPass, "asan-module", "AddressSanitizer: detects use-after-free and out-of-bounds bugs." "ModulePass", false, false) ModulePass *llvm | |
| static size_t | TypeSizeToSizeIndex (uint32_t TypeSize) |
| static GlobalVariable * | createPrivateGlobalForSourceLoc (Module &M, LocationMetadata MD) |
| Create a global describing a source location. More... | |
| static bool | GlobalWasGeneratedByCompiler (GlobalVariable *G) |
Check if G has been created by a trusted compiler pass. More... | |
| static bool | isPointerOperand (Value *V) |
| static bool | isInterestingPointerComparison (Instruction *I) |
| static bool | isInterestingPointerSubtraction (Instruction *I) |
| static void | doInstrumentAddress (AddressSanitizer *Pass, Instruction *I, Instruction *InsertBefore, Value *Addr, unsigned Alignment, unsigned Granularity, uint32_t TypeSize, bool IsWrite, Value *SizeArgument, bool UseCalls, uint32_t Exp) |
| static void | instrumentMaskedLoadOrStore (AddressSanitizer *Pass, const DataLayout &DL, Type *IntptrTy, Value *Mask, Instruction *I, Value *Addr, unsigned Alignment, unsigned Granularity, uint32_t TypeSize, bool IsWrite, Value *SizeArgument, bool UseCalls, uint32_t Exp) |
| static int | StackMallocSizeClass (uint64_t LocalStackSize) |
Variables | |
| static const uint64_t | kDefaultShadowScale = 3 |
| static const uint64_t | kDefaultShadowOffset32 = 1ULL << 29 |
| static const uint64_t | kDefaultShadowOffset64 = 1ULL << 44 |
| static const uint64_t | kDynamicShadowSentinel |
| static const uint64_t | kSmallX86_64ShadowOffsetBase = 0x7FFFFFFF |
| static const uint64_t | kSmallX86_64ShadowOffsetAlignMask = ~0xFFFULL |
| static const uint64_t | kLinuxKasan_ShadowOffset64 = 0xdffffc0000000000 |
| static const uint64_t | kPPC64_ShadowOffset64 = 1ULL << 44 |
| static const uint64_t | kSystemZ_ShadowOffset64 = 1ULL << 52 |
| static const uint64_t | kMIPS32_ShadowOffset32 = 0x0aaa0000 |
| static const uint64_t | kMIPS64_ShadowOffset64 = 1ULL << 37 |
| static const uint64_t | kAArch64_ShadowOffset64 = 1ULL << 36 |
| static const uint64_t | kFreeBSD_ShadowOffset32 = 1ULL << 30 |
| static const uint64_t | kFreeBSD_ShadowOffset64 = 1ULL << 46 |
| static const uint64_t | kNetBSD_ShadowOffset32 = 1ULL << 30 |
| static const uint64_t | kNetBSD_ShadowOffset64 = 1ULL << 46 |
| static const uint64_t | kNetBSDKasan_ShadowOffset64 = 0xdfff900000000000 |
| static const uint64_t | kPS4CPU_ShadowOffset64 = 1ULL << 40 |
| static const uint64_t | kWindowsShadowOffset32 = 3ULL << 28 |
| static const uint64_t | kEmscriptenShadowOffset = 0 |
| static const uint64_t | kMyriadShadowScale = 5 |
| static const uint64_t | kMyriadMemoryOffset32 = 0x80000000ULL |
| static const uint64_t | kMyriadMemorySize32 = 0x20000000ULL |
| static const uint64_t | kMyriadTagShift = 29 |
| static const uint64_t | kMyriadDDRTag = 4 |
| static const uint64_t | kMyriadCacheBitMask32 = 0x40000000ULL |
| static const uint64_t | kWindowsShadowOffset64 = kDynamicShadowSentinel |
| static const size_t | kMinStackMallocSize = 1 << 6 |
| static const size_t | kMaxStackMallocSize = 1 << 16 |
| static const uintptr_t | kCurrentStackFrameMagic = 0x41B58AB3 |
| static const uintptr_t | kRetiredStackFrameMagic = 0x45E0360E |
| static const char *const | kAsanModuleCtorName = "asan.module_ctor" |
| static const char *const | kAsanModuleDtorName = "asan.module_dtor" |
| static const uint64_t | kAsanCtorAndDtorPriority = 1 |
| static const uint64_t | kAsanEmscriptenCtorAndDtorPriority = 50 |
| static const char *const | kAsanReportErrorTemplate = "__asan_report_" |
| static const char *const | kAsanRegisterGlobalsName = "__asan_register_globals" |
| static const char *const | kAsanUnregisterGlobalsName |
| static const char *const | kAsanRegisterImageGlobalsName |
| static const char *const | kAsanUnregisterImageGlobalsName |
| static const char *const | kAsanRegisterElfGlobalsName |
| static const char *const | kAsanUnregisterElfGlobalsName |
| static const char *const | kAsanPoisonGlobalsName = "__asan_before_dynamic_init" |
| static const char *const | kAsanUnpoisonGlobalsName = "__asan_after_dynamic_init" |
| static const char *const | kAsanInitName = "__asan_init" |
| static const char *const | kAsanVersionCheckNamePrefix |
| static const char *const | kAsanPtrCmp = "__sanitizer_ptr_cmp" |
| static const char *const | kAsanPtrSub = "__sanitizer_ptr_sub" |
| static const char *const | kAsanHandleNoReturnName = "__asan_handle_no_return" |
| static const int | kMaxAsanStackMallocSizeClass = 10 |
| static const char *const | kAsanStackMallocNameTemplate = "__asan_stack_malloc_" |
| static const char *const | kAsanStackFreeNameTemplate = "__asan_stack_free_" |
| static const char *const | kAsanGenPrefix = "___asan_gen_" |
| static const char *const | kODRGenPrefix = "__odr_asan_gen_" |
| static const char *const | kSanCovGenPrefix = "__sancov_gen_" |
| static const char *const | kAsanSetShadowPrefix = "__asan_set_shadow_" |
| static const char *const | kAsanPoisonStackMemoryName |
| static const char *const | kAsanUnpoisonStackMemoryName |
| static const char *const | kAsanGlobalsRegisteredFlagName |
| static const char *const | kAsanOptionDetectUseAfterReturn |
| static const char *const | kAsanShadowMemoryDynamicAddress |
| static const char *const | kAsanAllocaPoison = "__asan_alloca_poison" |
| static const char *const | kAsanAllocasUnpoison = "__asan_allocas_unpoison" |
| static const size_t | kNumberOfAccessSizes = 5 |
| static const unsigned | kAllocaRzSize = 32 |
| static cl::opt< bool > | ClEnableKasan ("asan-kernel", cl::desc("Enable KernelAddressSanitizer instrumentation"), cl::Hidden, cl::init(false)) |
| static cl::opt< bool > | ClRecover ("asan-recover", cl::desc("Enable recovery mode (continue-after-error)."), cl::Hidden, cl::init(false)) |
| static cl::opt< bool > | ClInsertVersionCheck ("asan-guard-against-version-mismatch", cl::desc("Guard against compiler/runtime version mismatch."), cl::Hidden, cl::init(true)) |
| static cl::opt< bool > | ClInstrumentReads ("asan-instrument-reads", cl::desc("instrument read instructions"), cl::Hidden, cl::init(true)) |
| static cl::opt< bool > | ClInstrumentWrites ("asan-instrument-writes", cl::desc("instrument write instructions"), cl::Hidden, cl::init(true)) |
| static cl::opt< bool > | ClInstrumentAtomics ("asan-instrument-atomics", cl::desc("instrument atomic instructions (rmw, cmpxchg)"), cl::Hidden, cl::init(true)) |
| static cl::opt< bool > | ClAlwaysSlowPath ("asan-always-slow-path", cl::desc("use instrumentation with slow path for all accesses"), cl::Hidden, cl::init(false)) |
| static cl::opt< bool > | ClForceDynamicShadow ("asan-force-dynamic-shadow", cl::desc("Load shadow address into a local variable for each function"), cl::Hidden, cl::init(false)) |
| static cl::opt< bool > | ClWithIfunc ("asan-with-ifunc", cl::desc("Access dynamic shadow through an ifunc global on " "platforms that support this"), cl::Hidden, cl::init(true)) |
| static cl::opt< bool > | ClWithIfuncSuppressRemat ("asan-with-ifunc-suppress-remat", cl::desc("Suppress rematerialization of dynamic shadow address by passing " "it through inline asm in prologue."), cl::Hidden, cl::init(true)) |
| static cl::opt< int > | ClMaxInsnsToInstrumentPerBB ("asan-max-ins-per-bb", cl::init(10000), cl::desc("maximal number of instructions to instrument in any given BB"), cl::Hidden) |
| static cl::opt< bool > | ClStack ("asan-stack", cl::desc("Handle stack memory"), cl::Hidden, cl::init(true)) |
| static cl::opt< uint32_t > | ClMaxInlinePoisoningSize ("asan-max-inline-poisoning-size", cl::desc("Inline shadow poisoning for blocks up to the given size in bytes."), cl::Hidden, cl::init(64)) |
| static cl::opt< bool > | ClUseAfterReturn ("asan-use-after-return", cl::desc("Check stack-use-after-return"), cl::Hidden, cl::init(true)) |
| static cl::opt< bool > | ClRedzoneByvalArgs ("asan-redzone-byval-args", cl::desc("Create redzones for byval " "arguments (extra copy " "required)"), cl::Hidden, cl::init(true)) |
| static cl::opt< bool > | ClUseAfterScope ("asan-use-after-scope", cl::desc("Check stack-use-after-scope"), cl::Hidden, cl::init(false)) |
| static cl::opt< bool > | ClGlobals ("asan-globals", cl::desc("Handle global objects"), cl::Hidden, cl::init(true)) |
| static cl::opt< bool > | ClInitializers ("asan-initialization-order", cl::desc("Handle C++ initializer order"), cl::Hidden, cl::init(true)) |
| static cl::opt< bool > | ClInvalidPointerPairs ("asan-detect-invalid-pointer-pair", cl::desc("Instrument <, <=, >, >=, - with pointer operands"), cl::Hidden, cl::init(false)) |
| static cl::opt< bool > | ClInvalidPointerCmp ("asan-detect-invalid-pointer-cmp", cl::desc("Instrument <, <=, >, >= with pointer operands"), cl::Hidden, cl::init(false)) |
| static cl::opt< bool > | ClInvalidPointerSub ("asan-detect-invalid-pointer-sub", cl::desc("Instrument - operations with pointer operands"), cl::Hidden, cl::init(false)) |
| static cl::opt< unsigned > | ClRealignStack ("asan-realign-stack", cl::desc("Realign stack to the value of this flag (power of two)"), cl::Hidden, cl::init(32)) |
| static cl::opt< int > | ClInstrumentationWithCallsThreshold ("asan-instrumentation-with-call-threshold", cl::desc("If the function being instrumented contains more than " "this number of memory accesses, use callbacks instead of " "inline checks (-1 means never use callbacks)."), cl::Hidden, cl::init(7000)) |
| static cl::opt< std::string > | ClMemoryAccessCallbackPrefix ("asan-memory-access-callback-prefix", cl::desc("Prefix for memory access callbacks"), cl::Hidden, cl::init("__asan_")) |
| static cl::opt< bool > | ClInstrumentDynamicAllocas ("asan-instrument-dynamic-allocas", cl::desc("instrument dynamic allocas"), cl::Hidden, cl::init(true)) |
| static cl::opt< bool > | ClSkipPromotableAllocas ("asan-skip-promotable-allocas", cl::desc("Do not instrument promotable allocas"), cl::Hidden, cl::init(true)) |
| static cl::opt< int > | ClMappingScale ("asan-mapping-scale", cl::desc("scale of asan shadow mapping"), cl::Hidden, cl::init(0)) |
| static cl::opt< uint64_t > | ClMappingOffset ("asan-mapping-offset", cl::desc("offset of asan shadow mapping [EXPERIMENTAL]"), cl::Hidden, cl::init(0)) |
| static cl::opt< bool > | ClOpt ("asan-opt", cl::desc("Optimize instrumentation"), cl::Hidden, cl::init(true)) |
| static cl::opt< bool > | ClOptSameTemp ("asan-opt-same-temp", cl::desc("Instrument the same temp just once"), cl::Hidden, cl::init(true)) |
| static cl::opt< bool > | ClOptGlobals ("asan-opt-globals", cl::desc("Don't instrument scalar globals"), cl::Hidden, cl::init(true)) |
| static cl::opt< bool > | ClOptStack ("asan-opt-stack", cl::desc("Don't instrument scalar stack variables"), cl::Hidden, cl::init(false)) |
| static cl::opt< bool > | ClDynamicAllocaStack ("asan-stack-dynamic-alloca", cl::desc("Use dynamic alloca to represent stack variables"), cl::Hidden, cl::init(true)) |
| static cl::opt< uint32_t > | ClForceExperiment ("asan-force-experiment", cl::desc("Force optimization experiment (for testing)"), cl::Hidden, cl::init(0)) |
| static cl::opt< bool > | ClUsePrivateAlias ("asan-use-private-alias", cl::desc("Use private aliases for global variables"), cl::Hidden, cl::init(false)) |
| static cl::opt< bool > | ClUseOdrIndicator ("asan-use-odr-indicator", cl::desc("Use odr indicators to improve ODR reporting"), cl::Hidden, cl::init(false)) |
| static cl::opt< bool > | ClUseGlobalsGC ("asan-globals-live-support", cl::desc("Use linker features to support dead " "code stripping of globals"), cl::Hidden, cl::init(true)) |
| static cl::opt< bool > | ClWithComdat ("asan-with-comdat", cl::desc("Place ASan constructors in comdat sections"), cl::Hidden, cl::init(true)) |
| static cl::opt< int > | ClDebug ("asan-debug", cl::desc("debug"), cl::Hidden, cl::init(0)) |
| static cl::opt< int > | ClDebugStack ("asan-debug-stack", cl::desc("debug stack"), cl::Hidden, cl::init(0)) |
| static cl::opt< std::string > | ClDebugFunc ("asan-debug-func", cl::Hidden, cl::desc("Debug func")) |
| static cl::opt< int > | ClDebugMin ("asan-debug-min", cl::desc("Debug min inst"), cl::Hidden, cl::init(-1)) |
| static cl::opt< int > | ClDebugMax ("asan-debug-max", cl::desc("Debug max inst"), cl::Hidden, cl::init(-1)) |
| INITIALIZE_PASS(ASanGlobalsMetadataWrapperPass, "asan-globals-md", "Read metadata to mark which globals should be instrumented " "when running ASan.", false, true) char AddressSanitizerLegacyPass | asan |
| INITIALIZE_PASS(ASanGlobalsMetadataWrapperPass, "asan-globals-md", "Read metadata to mark which globals should be instrumented " "when running ASan.", false, true) char AddressSanitizerLegacyPass | AddressSanitizer |
| INITIALIZE_PASS(ASanGlobalsMetadataWrapperPass, "asan-globals-md", "Read metadata to mark which globals should be instrumented " "when running ASan.", false, true) char AddressSanitizerLegacyPass | false |
| #define DEBUG_TYPE "asan" |
Definition at line 91 of file AddressSanitizer.cpp.
|
static |
Create a global describing a source location.
Definition at line 1251 of file AddressSanitizer.cpp.
References llvm::LocationMetadata::ColumnNo, llvm::createPrivateGlobalForString(), llvm::LocationMetadata::Filename, llvm::ConstantInt::get(), llvm::ConstantStruct::getAnon(), llvm::Module::getContext(), llvm::Type::getInt32Ty(), llvm::GlobalValue::Global, kAsanGenPrefix, llvm::LocationMetadata::LineNo, llvm::GlobalValue::PrivateLinkage, and llvm::GlobalValue::setUnnamedAddr().
Referenced by instrumentMaskedLoadOrStore().
|
static |
Definition at line 1492 of file AddressSanitizer.cpp.
Referenced by instrumentMaskedLoadOrStore().
|
static |
Definition at line 541 of file AddressSanitizer.cpp.
References llvm::AnalysisUsage::addRequired(), AddressSanitizer, assert(), C, ClDebugStack, llvm::SmallVectorImpl< T >::clear(), ClEnableKasan, ClInstrumentDynamicAllocas, ClRecover, ClRedzoneByvalArgs, ClStack, ClUseAfterScope, ClUseGlobalsGC, ClUseOdrIndicator, ClUsePrivateAlias, ClWithComdat, llvm::CallInst::Create(), llvm::IRBuilder< T, Inserter >::CreateAdd(), llvm::IRBuilder< T, Inserter >::CreateCall(), llvm::IRBuilder< T, Inserter >::CreateLoad(), llvm::IRBuilder< T, Inserter >::CreatePtrToInt(), llvm::dbgs(), llvm::depth_first(), llvm::dyn_cast(), llvm::SmallVectorBase::empty(), F(), llvm::findAllocaForValue(), G, llvm::PointerType::get(), llvm::AllocaInst::getAlignment(), getAllocaSizeInBytes(), llvm::AllocaInst::getAllocatedType(), llvm::CallBase::getArgOperand(), llvm::AllocaInst::getArraySize(), llvm::Module::getContext(), llvm::Module::getDataLayout(), llvm::Intrinsic::getDeclaration(), llvm::Function::getEntryBlock(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, CallBrTy, IterTy >::getInstruction(), llvm::Type::getIntNTy(), llvm::IntrinsicInst::getIntrinsicID(), llvm::Instruction::getModule(), llvm::GlobalValue::getParent(), llvm::PassRegistry::getPassRegistry(), llvm::DataLayout::getPointerSizeInBits(), getShadowMapping(), llvm::Module::getTargetTriple(), llvm::DataLayout::getTypeAllocSize(), llvm::ConstantInt::getZExtValue(), I, llvm::initializeAddressSanitizerLegacyPassPass(), llvm::initializeASanGlobalsMetadataWrapperPassPass(), llvm::initializeModuleAddressSanitizerLegacyPassPass(), llvm::AllocaInst::isArrayAllocation(), llvm::Instruction::isLifetimeStartOrEnd(), llvm::Triple::isOSEmscripten(), llvm::AllocaInst::isStaticAlloca(), llvm::ConstantInt::isValueValidForType(), kAsanCtorAndDtorPriority, kAsanEmscriptenCtorAndDtorPriority, kMaxAsanStackMallocSizeClass, kNumberOfAccessSizes, LLVM_DEBUG, llvm::max(), MI, Pass, llvm::SmallVectorTemplateBase< T >::push_back(), RedzoneSizeForScale(), llvm::MipsISD::Ret, runOnFunction(), llvm::AnalysisUsage::setPreservesAll(), and Size.
Referenced by instrumentMaskedLoadOrStore().
Definition at line 426 of file AddressSanitizer.cpp.
References llvm::Triple::aarch64, ClForceDynamicShadow, ClMappingOffset, ClMappingScale, ClWithIfunc, llvm::Triple::getArch(), llvm::Triple::getVendor(), llvm::Triple::isAndroid(), llvm::Triple::isAndroidVersionLT(), llvm::Triple::isARM(), llvm::Triple::isiOS(), llvm::Triple::isMIPS32(), llvm::Triple::isMIPS64(), llvm::Triple::isOSEmscripten(), llvm::Triple::isOSFreeBSD(), llvm::Triple::isOSFuchsia(), llvm::Triple::isOSLinux(), llvm::Triple::isOSNetBSD(), llvm::Triple::isOSWindows(), llvm::Triple::isPS4CPU(), llvm::Triple::isThumb(), llvm::Triple::isWatchOS(), kAArch64_ShadowOffset64, kDefaultShadowOffset32, kDefaultShadowOffset64, kDefaultShadowScale, kDynamicShadowSentinel, kEmscriptenShadowOffset, kFreeBSD_ShadowOffset32, kFreeBSD_ShadowOffset64, kLinuxKasan_ShadowOffset64, kMIPS32_ShadowOffset32, kMIPS64_ShadowOffset64, kMyriadMemoryOffset32, kMyriadMemorySize32, kMyriadShadowScale, kNetBSD_ShadowOffset32, kNetBSD_ShadowOffset64, kNetBSDKasan_ShadowOffset64, kPPC64_ShadowOffset64, kPS4CPU_ShadowOffset64, kSmallX86_64ShadowOffsetAlignMask, kSmallX86_64ShadowOffsetBase, kSystemZ_ShadowOffset64, kWindowsShadowOffset32, kWindowsShadowOffset64, llvm::Triple::Myriad, llvm::Triple::ppc64, llvm::Triple::ppc64le, llvm::Triple::systemz, and llvm::Triple::x86_64.
Referenced by GetCtorAndDtorPriority().
|
static |
Check if G has been created by a trusted compiler pass.
Definition at line 1267 of file AddressSanitizer.cpp.
References ClInstrumentAtomics, ClInstrumentReads, ClInstrumentWrites, ClSkipPromotableAllocas, llvm::IRBuilder< T, Inserter >::CreateAdd(), llvm::IRBuilder< T, Inserter >::CreateCall(), llvm::IRBuilder< T, Inserter >::CreateIntCast(), llvm::IRBuilder< T, Inserter >::CreateLShr(), llvm::IRBuilder< T, Inserter >::CreateOr(), llvm::IRBuilder< T, Inserter >::CreatePointerCast(), llvm::dyn_cast(), llvm::Instruction::eraseFromParent(), F(), llvm::ConstantInt::get(), getAllocaSizeInBytes(), llvm::AllocaInst::getAllocatedType(), llvm::Module::getDataLayout(), llvm::IRBuilderBase::getInt32Ty(), llvm::IRBuilderBase::getInt8PtrTy(), llvm::Instruction::getModule(), llvm::Value::getName(), llvm::User::getOperand(), llvm::Type::getPointerAddressSpace(), llvm::Type::getScalarType(), llvm::Value::getType(), llvm::DataLayout::getTypeStoreSizeInBits(), llvm::Instruction::hasMetadata(), I, llvm::isAllocaPromotable(), llvm::Type::isSized(), llvm::AllocaInst::isStaticAlloca(), llvm::AllocaInst::isSwiftError(), llvm::Value::isSwiftError(), llvm::AllocaInst::isUsedWithInAlloca(), MI, SI, and llvm::StringRef::startswith().
Referenced by instrumentMaskedLoadOrStore().
| INITIALIZE_PASS | ( | ModuleAddressSanitizerLegacyPass | , |
| "asan-module" | , | ||
| "AddressSanitizer: detects use-after-free and out-of-bounds bugs." "ModulePass" | , | ||
| false | , | ||
| false | |||
| ) |
Definition at line 1231 of file AddressSanitizer.cpp.
References assert().
Referenced by llvm::ModuleAddressSanitizerPass::run().
| INITIALIZE_PASS (ASanGlobalsMetadataWrapperPass, "asan-globals-md", "Read metadata to mark which globals should be instrumented " "when running ASan.", false, true) char AddressSanitizerLegacyPass INITIALIZE_PASS_BEGIN | ( | AddressSanitizerLegacyPass | , |
| "asan" | , | ||
| "AddressSanitizer: detects use-after-free and out-of-bounds bugs." | , | ||
| false | , | ||
| false | |||
| ) |
Referenced by llvm::ModuleAddressSanitizerPass::run().
|
static |
Definition at line 1509 of file AddressSanitizer.cpp.
References llvm::GlobalVariable::addDebugInfo(), llvm::AMDGPU::HSAMD::Kernel::Arg::Key::Align, llvm::Comdat::Any, llvm::appendToCompilerUsed(), llvm::appendToGlobalCtors(), llvm::appendToGlobalDtors(), Arg, llvm::CallBase::arg_operands(), llvm::HexStyle::Asm, assert(), llvm::assumeAligned(), llvm::GlobalValue::AvailableExternallyLinkage, llvm::BasicBlock::begin(), C, ClAlwaysSlowPath, ClDebugFunc, ClDebugMax, ClDebugMin, llvm::SmallPtrSetImplBase::clear(), ClForceExperiment, ClGlobals, ClInitializers, ClInsertVersionCheck, ClInstrumentationWithCallsThreshold, ClInvalidPointerCmp, ClInvalidPointerPairs, ClInvalidPointerSub, ClMaxInsnsToInstrumentPerBB, ClMemoryAccessCallbackPrefix, ClOpt, ClOptGlobals, ClOptSameTemp, ClOptStack, ClWithIfuncSuppressRemat, llvm::Triple::COFF, llvm::GlobalValue::CommonLinkage, llvm::StringRef::contains(), llvm::GlobalVariable::copyAttributesFrom(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::GlobalAlias::create(), llvm::BasicBlock::Create(), llvm::Function::Create(), llvm::CallInst::Create(), llvm::ReturnInst::Create(), llvm::BranchInst::Create(), llvm::IRBuilder< T, Inserter >::CreateAdd(), llvm::IRBuilder< T, Inserter >::CreateAnd(), llvm::MDBuilder::createBranchWeights(), llvm::IRBuilder< T, Inserter >::CreateCall(), llvm::IRBuilder< T, Inserter >::CreateExtractElement(), llvm::IRBuilder< T, Inserter >::CreateGEP(), llvm::IRBuilder< T, Inserter >::CreateICmpEQ(), llvm::IRBuilder< T, Inserter >::CreateICmpNE(), llvm::IRBuilder< T, Inserter >::CreateICmpSGE(), llvm::IRBuilder< T, Inserter >::CreateIntCast(), llvm::IRBuilder< T, Inserter >::CreateIntToPtr(), llvm::IRBuilder< T, Inserter >::CreateLoad(), llvm::IRBuilder< T, Inserter >::CreateLShr(), llvm::IRBuilder< T, Inserter >::CreatePointerCast(), createPrivateGlobalForSourceLoc(), llvm::createPrivateGlobalForString(), llvm::createSanitizerCtorAndInitFunctions(), llvm::dbgs(), llvm::declareSanitizerInitFunction(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, CallBrTy, IterTy >::doesNotReturn(), doInstrumentAddress(), llvm::GlobalValue::dropLLVMManglingEscape(), llvm::dyn_cast(), llvm::Triple::ELF, llvm::StringRef::empty(), llvm::Module::empty(), llvm::Comdat::ExactMatch, llvm::GlobalValue::ExternalWeakLinkage, F(), llvm::StringRef::find(), llvm::BasicBlock::front(), llvm::Function::front(), G, llvm::InlineAsm::get(), llvm::IntegerType::get(), llvm::ConstantInt::get(), llvm::FunctionType::get(), llvm::StructType::get(), llvm::ValueAsMetadata::get(), llvm::ArrayType::get(), llvm::ConstantArray::get(), llvm::ConstantStruct::get(), llvm::PointerType::get(), llvm::MDNode::get(), llvm::GlobalValue::getAddressSpace(), llvm::Constant::getAggregateElement(), llvm::GlobalObject::getAlignment(), llvm::Function::getBasicBlockList(), llvm::GlobalObject::getComdat(), llvm::Module::getContext(), GetCtorAndDtorPriority(), llvm::Module::getDataLayout(), llvm::Instruction::getDebugLoc(), llvm::GlobalValue::getDLLStorageClass(), llvm::Function::getEntryBlock(), llvm::BasicBlock::getFirstInsertionPt(), llvm::Module::getFunction(), llvm::ConstantExpr::getGetElementPtr(), llvm::Module::getGlobalVariable(), llvm::GlobalVariable::getInitializer(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, CallBrTy, IterTy >::getInstruction(), llvm::IRBuilderBase::getInt32(), llvm::IRBuilderBase::getInt32Ty(), llvm::Type::getInt32Ty(), llvm::IRBuilderBase::getInt8PtrTy(), llvm::IRBuilderBase::getInt8Ty(), llvm::IntrinsicInst::getIntrinsicID(), llvm::ConstantExpr::getIntToPtr(), llvm::GlobalValue::getLinkage(), llvm::Module::getModuleIdentifier(), llvm::Value::getName(), llvm::Constant::getNullValue(), llvm::CallBase::getNumArgOperands(), llvm::User::getOperand(), llvm::Module::getOrInsertComdat(), llvm::Module::getOrInsertFunction(), llvm::Module::getOrInsertGlobal(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::ConstantExpr::getPointerCast(), llvm::DataLayout::getPointerSizeInBits(), llvm::GlobalObject::getSection(), llvm::Instruction::getSuccessor(), llvm::Module::getTargetTriple(), llvm::GlobalValue::getThreadLocalMode(), getType(), llvm::Value::getType(), llvm::DataLayout::getTypeAllocSize(), llvm::DataLayout::getTypeStoreSizeInBits(), llvm::GetUnderlyingObject(), llvm::getUniqueModuleId(), llvm::GlobalValue::getValueType(), llvm::GlobalValue::getVisibility(), llvm::Type::getVoidTy(), llvm::IRBuilderBase::getVoidTy(), llvm::Module::globals(), GlobalWasGeneratedByCompiler(), llvm::GlobalObject::hasComdat(), llvm::GlobalValue::hasExactDefinition(), llvm::Function::hasFnAttribute(), llvm::GlobalVariable::hasInitializer(), llvm::GlobalValue::hasLocalLinkage(), llvm::Value::hasName(), llvm::GlobalValue::hasPrivateLinkage(), llvm::GlobalObject::hasSection(), llvm::GlobalValue::HiddenVisibility, I, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::GlobalValue::InternalLinkage, llvm::GlobalVariable::isConstant(), llvm::CallBase::isInlineAsm(), isInterestingPointerComparison(), isInterestingPointerSubtraction(), llvm::GlobalValue::isInterposable(), llvm::isPowerOf2_32(), llvm::Type::isSized(), llvm::AllocaInst::isStaticAlloca(), llvm::GlobalValue::isThreadLocal(), llvm::itostr(), kAsanGenPrefix, kAsanInitName, kAsanModuleCtorName, kAsanSetShadowPrefix, kDynamicShadowSentinel, kMaxAsanStackMallocSizeClass, kMyriadCacheBitMask32, kMyriadDDRTag, kMyriadTagShift, kNumberOfAccessSizes, llvm::Comdat::Largest, LLVM_DEBUG, llvm_unreachable, llvm::Triple::MachO, llvm::max(), llvm::maybeMarkSanitizerLibraryCallNoBuiltin(), llvm::Triple::Myriad, N, Name, llvm::Comdat::NoDuplicates, llvm::Align::None(), llvm::GlobalValue::None, llvm::StringRef::npos, OP, llvm::User::operands(), llvm::MCSectionMachO::ParseSectionSpecifier(), llvm::GlobalValue::PrivateLinkage, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::Value::replaceAllUsesWith(), llvm::ReplaceInstWithInst(), llvm::report_fatal_error(), llvm::ObjectSizeOpts::RoundToAlign, llvm::NVPTX::PTXCvtMode::RZ, llvm::MachO::S_CSTRING_LITERALS, llvm::Comdat::SameSize, llvm::ARMBuildAttrs::Section, llvm::GlobalObject::setAlignment(), llvm::GlobalObject::setComdat(), llvm::Instruction::setDebugLoc(), llvm::IRBuilderBase::SetInsertPoint(), llvm::GlobalValue::setLinkage(), llvm::GlobalObject::setMetadata(), llvm::Value::setName(), llvm::GlobalObject::setSection(), llvm::Comdat::setSelectionKind(), llvm::GlobalValue::setUnnamedAddr(), llvm::GlobalValue::setVisibility(), Size, llvm::SmallVectorBase::size(), llvm::ArrayRef< T >::size(), llvm::SplitBlockAndInsertIfThen(), llvm::StringRef::startswith(), llvm::Tag, llvm::Value::takeName(), llvm::to_string(), TypeSizeToSizeIndex(), llvm::Triple::UnknownObjectFormat, llvm::Vector, llvm::IndexedInstrProf::Version, llvm::Triple::Wasm, and llvm::Triple::XCOFF.
|
static |
Definition at line 1445 of file AddressSanitizer.cpp.
References llvm::User::getOperand(), and isPointerOperand().
Referenced by instrumentMaskedLoadOrStore().
|
static |
Definition at line 1459 of file AddressSanitizer.cpp.
References llvm::IRBuilder< T, Inserter >::CreateCall(), llvm::IRBuilder< T, Inserter >::CreatePointerCast(), F(), G, llvm::User::getOperand(), llvm::GlobalVariable::hasInitializer(), I, and isPointerOperand().
Referenced by instrumentMaskedLoadOrStore().
Definition at line 1438 of file AddressSanitizer.cpp.
References llvm::Value::getType(), and llvm::Type::isPointerTy().
Referenced by isInterestingPointerComparison(), and isInterestingPointerSubtraction().
|
static |
Definition at line 535 of file AddressSanitizer.cpp.
References llvm::max().
Referenced by GetCtorAndDtorPriority().
|
static |
Definition at line 2884 of file AddressSanitizer.cpp.
References Arg, llvm::Function::args(), assert(), llvm::IRBuilder< T, Inserter >::CreateAlloca(), llvm::IRBuilderBase::CreateMemCpy(), llvm::BasicBlock::front(), llvm::Function::front(), llvm::Module::getDataLayout(), llvm::ilist_node_with_parent< NodeTy, ParentTy, Options >::getNextNode(), llvm::GlobalValue::getParent(), llvm::DataLayout::getTypeAllocSize(), llvm::DataLayout::getValueOrABITypeAlignment(), kMaxStackMallocSize, kMinStackMallocSize, llvm_unreachable, and llvm::AllocaInst::setAlignment().
| STATISTIC | ( | NumInstrumentedReads | , |
| "Number of instrumented reads" | |||
| ) |
| STATISTIC | ( | NumInstrumentedWrites | , |
| "Number of instrumented writes" | |||
| ) |
| STATISTIC | ( | NumOptimizedAccessesToGlobalVar | , |
| "Number of optimized accesses to global vars" | |||
| ) |
| STATISTIC | ( | NumOptimizedAccessesToStackVar | , |
| "Number of optimized accesses to stack vars" | |||
| ) |
|
static |
Definition at line 1244 of file AddressSanitizer.cpp.
References assert(), llvm::countTrailingZeros(), and kNumberOfAccessSizes.
Referenced by instrumentMaskedLoadOrStore().
| INITIALIZE_PASS (ASanGlobalsMetadataWrapperPass, "asan-globals-md", "Read metadata to mark which globals should be instrumented " "when running ASan.", false, true) char AddressSanitizerLegacyPass AddressSanitizer |
Definition at line 1218 of file AddressSanitizer.cpp.
Referenced by GetCtorAndDtorPriority(), and llvm::AddressSanitizerPass::run().
| INITIALIZE_PASS (ASanGlobalsMetadataWrapperPass, "asan-globals-md", "Read metadata to mark which globals should be instrumented " "when running ASan.", false, true) char AddressSanitizerLegacyPass asan |
Definition at line 1218 of file AddressSanitizer.cpp.
|
static |
Referenced by instrumentMaskedLoadOrStore().
Referenced by instrumentMaskedLoadOrStore().
|
static |
Referenced by instrumentMaskedLoadOrStore().
|
static |
Referenced by instrumentMaskedLoadOrStore().
|
static |
Referenced by GetCtorAndDtorPriority().
|
static |
|
static |
Referenced by GetCtorAndDtorPriority().
|
static |
Referenced by getShadowMapping().
|
static |
Referenced by instrumentMaskedLoadOrStore().
|
static |
Referenced by instrumentMaskedLoadOrStore().
|
static |
Referenced by instrumentMaskedLoadOrStore().
|
static |
Referenced by instrumentMaskedLoadOrStore().
|
static |
Referenced by instrumentMaskedLoadOrStore().
|
static |
Referenced by GlobalWasGeneratedByCompiler().
|
static |
Referenced by GetCtorAndDtorPriority().
|
static |
Referenced by GlobalWasGeneratedByCompiler().
|
static |
Referenced by GlobalWasGeneratedByCompiler().
|
static |
Referenced by instrumentMaskedLoadOrStore().
|
static |
Referenced by instrumentMaskedLoadOrStore().
|
static |
Referenced by instrumentMaskedLoadOrStore().
|
static |
Referenced by getShadowMapping().
|
static |
Referenced by getShadowMapping().
|
static |
|
static |
Referenced by instrumentMaskedLoadOrStore().
|
static |
Referenced by instrumentMaskedLoadOrStore().
|
static |
Referenced by instrumentMaskedLoadOrStore().
|
static |
Referenced by instrumentMaskedLoadOrStore().
|
static |
Referenced by instrumentMaskedLoadOrStore().
|
static |
Referenced by instrumentMaskedLoadOrStore().
|
static |
|
static |
Referenced by GetCtorAndDtorPriority().
|
static |
Referenced by GetCtorAndDtorPriority().
|
static |
Referenced by GlobalWasGeneratedByCompiler().
|
static |
Referenced by GetCtorAndDtorPriority().
|
static |
|
static |
Referenced by GetCtorAndDtorPriority().
|
static |
Referenced by GetCtorAndDtorPriority().
|
static |
Referenced by GetCtorAndDtorPriority().
|
static |
Referenced by GetCtorAndDtorPriority().
|
static |
Referenced by GetCtorAndDtorPriority().
|
static |
Referenced by getShadowMapping().
|
static |
Referenced by instrumentMaskedLoadOrStore().
| INITIALIZE_PASS (ASanGlobalsMetadataWrapperPass, "asan-globals-md", "Read metadata to mark which globals should be instrumented " "when running ASan.", false, true) char AddressSanitizerLegacyPass false |
Definition at line 1218 of file AddressSanitizer.cpp.
|
static |
Definition at line 105 of file AddressSanitizer.cpp.
Referenced by getShadowMapping().
Definition at line 184 of file AddressSanitizer.cpp.
Definition at line 178 of file AddressSanitizer.cpp.
Definition at line 179 of file AddressSanitizer.cpp.
|
static |
Definition at line 132 of file AddressSanitizer.cpp.
Referenced by GetCtorAndDtorPriority().
|
static |
Definition at line 134 of file AddressSanitizer.cpp.
Referenced by GetCtorAndDtorPriority().
Definition at line 158 of file AddressSanitizer.cpp.
Referenced by createPrivateGlobalForSourceLoc(), and instrumentMaskedLoadOrStore().
Definition at line 169 of file AddressSanitizer.cpp.
Definition at line 154 of file AddressSanitizer.cpp.
Definition at line 149 of file AddressSanitizer.cpp.
Referenced by instrumentMaskedLoadOrStore().
Definition at line 130 of file AddressSanitizer.cpp.
Referenced by instrumentMaskedLoadOrStore().
Definition at line 131 of file AddressSanitizer.cpp.
Definition at line 172 of file AddressSanitizer.cpp.
Definition at line 147 of file AddressSanitizer.cpp.
Definition at line 162 of file AddressSanitizer.cpp.
Definition at line 152 of file AddressSanitizer.cpp.
Definition at line 153 of file AddressSanitizer.cpp.
Definition at line 143 of file AddressSanitizer.cpp.
Definition at line 136 of file AddressSanitizer.cpp.
Definition at line 139 of file AddressSanitizer.cpp.
Definition at line 135 of file AddressSanitizer.cpp.
Definition at line 161 of file AddressSanitizer.cpp.
Referenced by instrumentMaskedLoadOrStore().
Definition at line 175 of file AddressSanitizer.cpp.
Definition at line 157 of file AddressSanitizer.cpp.
Definition at line 156 of file AddressSanitizer.cpp.
Definition at line 148 of file AddressSanitizer.cpp.
Definition at line 164 of file AddressSanitizer.cpp.
Definition at line 145 of file AddressSanitizer.cpp.
Definition at line 137 of file AddressSanitizer.cpp.
Definition at line 141 of file AddressSanitizer.cpp.
Definition at line 150 of file AddressSanitizer.cpp.
|
static |
Definition at line 127 of file AddressSanitizer.cpp.
|
static |
Definition at line 94 of file AddressSanitizer.cpp.
Referenced by getShadowMapping().
|
static |
Definition at line 95 of file AddressSanitizer.cpp.
Referenced by getShadowMapping().
|
static |
Definition at line 93 of file AddressSanitizer.cpp.
Referenced by getShadowMapping().
|
static |
Definition at line 96 of file AddressSanitizer.cpp.
Referenced by getShadowMapping(), and instrumentMaskedLoadOrStore().
|
static |
Definition at line 113 of file AddressSanitizer.cpp.
Referenced by getShadowMapping().
|
static |
Definition at line 106 of file AddressSanitizer.cpp.
Referenced by getShadowMapping().
|
static |
Definition at line 107 of file AddressSanitizer.cpp.
Referenced by getShadowMapping().
|
static |
Definition at line 100 of file AddressSanitizer.cpp.
Referenced by getShadowMapping().
|
static |
Definition at line 155 of file AddressSanitizer.cpp.
Referenced by GetCtorAndDtorPriority(), and instrumentMaskedLoadOrStore().
|
static |
Definition at line 126 of file AddressSanitizer.cpp.
Referenced by StackMallocSizeClass().
|
static |
Definition at line 125 of file AddressSanitizer.cpp.
Referenced by StackMallocSizeClass().
|
static |
Definition at line 103 of file AddressSanitizer.cpp.
Referenced by getShadowMapping().
|
static |
Definition at line 104 of file AddressSanitizer.cpp.
Referenced by getShadowMapping().
|
static |
Definition at line 120 of file AddressSanitizer.cpp.
Referenced by instrumentMaskedLoadOrStore().
|
static |
Definition at line 119 of file AddressSanitizer.cpp.
Referenced by instrumentMaskedLoadOrStore().
|
static |
Definition at line 116 of file AddressSanitizer.cpp.
Referenced by getShadowMapping().
|
static |
Definition at line 117 of file AddressSanitizer.cpp.
Referenced by getShadowMapping().
|
static |
Definition at line 115 of file AddressSanitizer.cpp.
Referenced by getShadowMapping().
|
static |
Definition at line 118 of file AddressSanitizer.cpp.
Referenced by instrumentMaskedLoadOrStore().
|
static |
Definition at line 108 of file AddressSanitizer.cpp.
Referenced by getShadowMapping().
|
static |
Definition at line 109 of file AddressSanitizer.cpp.
Referenced by getShadowMapping().
|
static |
Definition at line 110 of file AddressSanitizer.cpp.
Referenced by getShadowMapping().
|
static |
Definition at line 182 of file AddressSanitizer.cpp.
Referenced by createOrdering(), llvm::createThreadSanitizerLegacyPassPass(), GetCtorAndDtorPriority(), instrumentMaskedLoadOrStore(), and TypeSizeToSizeIndex().
Definition at line 159 of file AddressSanitizer.cpp.
|
static |
Definition at line 101 of file AddressSanitizer.cpp.
Referenced by getShadowMapping().
|
static |
Definition at line 111 of file AddressSanitizer.cpp.
Referenced by getShadowMapping().
|
static |
Definition at line 128 of file AddressSanitizer.cpp.
Definition at line 160 of file AddressSanitizer.cpp.
|
static |
Definition at line 99 of file AddressSanitizer.cpp.
Referenced by getShadowMapping().
|
static |
Definition at line 98 of file AddressSanitizer.cpp.
Referenced by getShadowMapping().
|
static |
Definition at line 102 of file AddressSanitizer.cpp.
Referenced by getShadowMapping().
|
static |
Definition at line 112 of file AddressSanitizer.cpp.
Referenced by getShadowMapping().
|
static |
Definition at line 123 of file AddressSanitizer.cpp.
Referenced by getShadowMapping().
1.8.13