void SanitizerMetadata::reportGlobalToASan(llvm::GlobalVariable *GV,
SourceLocation Loc, StringRef Name,
QualType Ty, bool IsDynInit,
- bool IsBlacklisted) {
+ bool IsExcluded) {
if (!isAsanHwasanOrMemTag(CGM.getLangOpts().Sanitize))
return;
IsDynInit &= !CGM.isInSanitizerBlacklist(GV, Loc, Ty, "init");
- IsBlacklisted |= CGM.isInSanitizerBlacklist(GV, Loc, Ty);
+ IsExcluded |= CGM.isInSanitizerBlacklist(GV, Loc, Ty);
llvm::Metadata *LocDescr = nullptr;
llvm::Metadata *GlobalName = nullptr;
llvm::LLVMContext &VMContext = CGM.getLLVMContext();
- if (!IsBlacklisted) {
+ if (!IsExcluded) {
// Don't generate source location and global name if it is blacklisted -
// it won't be instrumented anyway.
LocDescr = getLocationMetadata(Loc);
llvm::ConstantAsMetadata::get(
llvm::ConstantInt::get(llvm::Type::getInt1Ty(VMContext), IsDynInit)),
llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
- llvm::Type::getInt1Ty(VMContext), IsBlacklisted))};
+ llvm::Type::getInt1Ty(VMContext), IsExcluded))};
llvm::MDNode *ThisGlobal = llvm::MDNode::get(VMContext, GlobalMetadata);
llvm::NamedMDNode *AsanGlobals =
llvm::raw_string_ostream OS(QualName);
D.printQualifiedName(OS);
- bool IsBlacklisted = false;
+ bool IsExcluded = false;
for (auto Attr : D.specific_attrs<NoSanitizeAttr>())
if (Attr->getMask() & SanitizerKind::Address)
- IsBlacklisted = true;
+ IsExcluded = true;
reportGlobalToASan(GV, D.getLocation(), OS.str(), D.getType(), IsDynInit,
- IsBlacklisted);
+ IsExcluded);
}
void SanitizerMetadata::disableSanitizerForGlobal(llvm::GlobalVariable *GV) {
bool IsDynInit = false);
void reportGlobalToASan(llvm::GlobalVariable *GV, SourceLocation Loc,
StringRef Name, QualType Ty, bool IsDynInit = false,
- bool IsBlacklisted = false);
+ bool IsExcluded = false);
void disableSanitizerForGlobal(llvm::GlobalVariable *GV);
void disableSanitizerForInstruction(llvm::Instruction *I);
private:
LocationMetadata SourceLoc;
StringRef Name;
bool IsDynInit = false;
- bool IsBlacklisted = false;
+ bool IsExcluded = false;
Entry() = default;
};
}))
return true;
- // Disable SROA in the face of arbitrary casts we don't whitelist elsewhere.
+ // Disable SROA in the face of arbitrary casts we don't explicitly list
+ // elsewhere.
disableSROA(I.getOperand(0));
// If this is a floating-point cast, and the target says this operation
}
}
-// A whitelist of intrinsics that we know do not use objc pointers or decrement
+// A list of intrinsics that we know do not use objc pointers or decrement
// ref counts.
static bool isInertIntrinsic(unsigned ID) {
// TODO: Make this into a covered switch.
}
}
-// A whitelist of intrinsics that we know do not use objc pointers or decrement
+// A list of intrinsics that we know do not use objc pointers or decrement
// ref counts.
static bool isUseOnlyIntrinsic(unsigned ID) {
// We are conservative and even though intrinsics are unlikely to touch
function_ref<TargetLibraryInfo &(Function &)> GetTLI) {
// A brief explanation of leak checkers. The goal is to find bugs where
// pointers are forgotten, causing an accumulating growth in memory
- // usage over time. The common strategy for leak checkers is to whitelist the
- // memory pointed to by globals at exit. This is popular because it also
- // solves another problem where the main thread of a C++ program may shut down
- // before other threads that are still expecting to use those globals. To
+ // usage over time. The common strategy for leak checkers is to explicitly
+ // allow the memory pointed to by globals at exit. This is popular because it
+ // also solves another problem where the main thread of a C++ program may shut
+ // down before other threads that are still expecting to use those globals. To
// handle that case, we expect the program may create a singleton and never
// destroy it.
E.Name = Name->getString();
ConstantInt *IsDynInit = mdconst::extract<ConstantInt>(MDN->getOperand(3));
E.IsDynInit |= IsDynInit->isOne();
- ConstantInt *IsBlacklisted =
+ ConstantInt *IsExcluded =
mdconst::extract<ConstantInt>(MDN->getOperand(4));
- E.IsBlacklisted |= IsBlacklisted->isOne();
+ E.IsExcluded |= IsExcluded->isOne();
}
}
// FIXME: Metadata should be attched directly to the global directly instead
// of being added to llvm.asan.globals.
- if (GlobalsMD.get(G).IsBlacklisted) return false;
+ if (GlobalsMD.get(G).IsExcluded) return false;
if (!Ty->isSized()) return false;
if (!G->hasInitializer()) return false;
// Only instrument globals of default address spaces
// Build set of globals that are aliased by some GA, where
// canInstrumentAliasedGlobal(GA) returns false.
- SmallPtrSet<const GlobalVariable *, 16> AliasedGlobalBlacklist;
+ SmallPtrSet<const GlobalVariable *, 16> AliasedGlobalExclusions;
if (CompileKernel) {
for (auto &GA : M.aliases()) {
if (const auto *GV = dyn_cast<GlobalVariable>(GA.getAliasee())) {
if (!canInstrumentAliasedGlobal(GA))
- AliasedGlobalBlacklist.insert(GV);
+ AliasedGlobalExclusions.insert(GV);
}
}
}
SmallVector<GlobalVariable *, 16> GlobalsToChange;
for (auto &G : M.globals()) {
- if (!AliasedGlobalBlacklist.count(&G) && shouldInstrumentGlobal(&G))
+ if (!AliasedGlobalExclusions.count(&G) && shouldInstrumentGlobal(&G))
GlobalsToChange.push_back(&G);
}
case Intrinsic::annotation:
case Intrinsic::ptr_annotation:
case Intrinsic::var_annotation:
- // TODO: the following intrinsics may also be whitelisted:
+ // TODO: the following intrinsics may also be allowed:
// lifetime_start, lifetime_end, invariant_start, invariant_end
return true;
}
return Changed;
}
-// Whitelist the instruction types NaryReassociate handles for now.
+// Explicitly list the instruction types NaryReassociate handles for now.
static bool isPotentiallyNaryReassociable(Instruction *I) {
switch (I->getOpcode()) {
case Instruction::Add:
return TTI.getUserCost(I, TargetTransformInfo::TCK_SizeAndLatency);
default:
- return UINT_MAX; // Disallow anything not whitelisted.
+ return UINT_MAX; // Disallow anything not explicitly listed.
}
}