ZarkoCA created this revision. ZarkoCA added reviewers: zaks.anna, jkorous, george.karpenkov, ygribov, Szelethus, quinnp, aaron.ballman. ZarkoCA added a project: clang. Herald added subscribers: manas, ASDenysPetrov, martong, dkrupp, donat.nagy, a.sidorin, baloghadamsoftware. ZarkoCA requested review of this revision. Herald added a subscriber: cfe-commits.
Replace variable and functions names, as well as comments that contain whitelist with more inclusive terms. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D112642 Files: clang/lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp clang/lib/StaticAnalyzer/Checkers/VforkChecker.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.h clang/lib/StaticAnalyzer/Core/MemRegion.cpp clang/test/Analysis/vfork.c
Index: clang/test/Analysis/vfork.c =================================================================== --- clang/test/Analysis/vfork.c +++ clang/test/Analysis/vfork.c @@ -15,7 +15,7 @@ case 0: // Ensure that modifying pid is ok. pid = 1; // no-warning - // Ensure that calling whitelisted routines is ok. + // Ensure that calling allowlisted routines is ok. switch (y) { case 0: execl("", "", 0); // no-warning @@ -65,7 +65,7 @@ case 0: // Ensure that writing pid is ok. pid = 1; // no-warning - // Ensure that calling whitelisted routines is ok. + // Ensure that calling allowlisted routines is ok. execl("", "", 0); // no-warning _exit(1); // no-warning break; Index: clang/lib/StaticAnalyzer/Core/MemRegion.cpp =================================================================== --- clang/lib/StaticAnalyzer/Core/MemRegion.cpp +++ clang/lib/StaticAnalyzer/Core/MemRegion.cpp @@ -974,7 +974,7 @@ // First handle the globals defined in system headers. if (Ctx.getSourceManager().isInSystemHeader(D->getLocation())) { - // Whitelist the system globals which often DO GET modified, assume the + // Allow the system globals which often DO GET modified, assume the // rest are immutable. if (D->getName().contains("errno")) sReg = getGlobalsRegion(MemRegion::GlobalSystemSpaceRegionKind); Index: clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.h =================================================================== --- clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.h +++ clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.h @@ -29,7 +29,7 @@ /// values). /// /// For more context see Static Analyzer checkers documentation - specifically -/// webkit.UncountedCallArgsChecker checker. Whitelist of transformations: +/// webkit.UncountedCallArgsChecker checker. Allowed list of transformations: /// - constructors of ref-counted types (including factory methods) /// - getters of ref-counted types /// - member overloaded operators Index: clang/lib/StaticAnalyzer/Checkers/VforkChecker.cpp =================================================================== --- clang/lib/StaticAnalyzer/Checkers/VforkChecker.cpp +++ clang/lib/StaticAnalyzer/Checkers/VforkChecker.cpp @@ -9,7 +9,7 @@ // This file defines vfork checker which checks for dangerous uses of vfork. // Vforked process shares memory (including stack) with parent so it's // range of actions is significantly limited: can't write variables, -// can't call functions not in whitelist, etc. For more details, see +// can't call functions not in allowed list, etc. For more details, see // http://man7.org/linux/man-pages/man2/vfork.2.html // // This checker checks for prohibited constructs in vforked process. @@ -44,13 +44,13 @@ class VforkChecker : public Checker<check::PreCall, check::PostCall, check::Bind, check::PreStmt<ReturnStmt>> { mutable std::unique_ptr<BuiltinBug> BT; - mutable llvm::SmallSet<const IdentifierInfo *, 10> VforkWhitelist; + mutable llvm::SmallSet<const IdentifierInfo *, 10> VforkAllowlist; mutable const IdentifierInfo *II_vfork; static bool isChildProcess(const ProgramStateRef State); bool isVforkCall(const Decl *D, CheckerContext &C) const; - bool isCallWhitelisted(const IdentifierInfo *II, CheckerContext &C) const; + bool isCallAllowlisted(const IdentifierInfo *II, CheckerContext &C) const; void reportBug(const char *What, CheckerContext &C, const char *Details = nullptr) const; @@ -93,9 +93,9 @@ } // Returns true iff ok to call function after successful vfork. -bool VforkChecker::isCallWhitelisted(const IdentifierInfo *II, +bool VforkChecker::isCallAllowlisted(const IdentifierInfo *II, CheckerContext &C) const { - if (VforkWhitelist.empty()) { + if (VforkAllowlist.empty()) { // According to manpage. const char *ids[] = { "_Exit", @@ -112,10 +112,10 @@ ASTContext &AC = C.getASTContext(); for (const char **id = ids; *id; ++id) - VforkWhitelist.insert(&AC.Idents.get(*id)); + VforkAllowlist.insert(&AC.Idents.get(*id)); } - return VforkWhitelist.count(II); + return VforkAllowlist.count(II); } void VforkChecker::reportBug(const char *What, CheckerContext &C, @@ -179,12 +179,12 @@ C.addTransition(ChildState); } -// Prohibit calls to non-whitelist functions in child process. +// Prohibit calls to non-allowlisted functions in child process. void VforkChecker::checkPreCall(const CallEvent &Call, CheckerContext &C) const { ProgramStateRef State = C.getState(); if (isChildProcess(State) - && !isCallWhitelisted(Call.getCalleeIdentifier(), C)) + && !isCallAllowlisted(Call.getCalleeIdentifier(), C)) reportBug("This function call", C); } Index: clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp =================================================================== --- clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp +++ clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp @@ -1188,14 +1188,14 @@ if (!invalidated) return state; - llvm::SmallPtrSet<SymbolRef, 8> WhitelistedSymbols; + llvm::SmallPtrSet<SymbolRef, 8> AllowlistedSymbols; for (const MemRegion *I : ExplicitRegions) if (const SymbolicRegion *SR = I->StripCasts()->getAs<SymbolicRegion>()) - WhitelistedSymbols.insert(SR->getSymbol()); + AllowlistedSymbols.insert(SR->getSymbol()); for (SymbolRef sym : *invalidated) { - if (WhitelistedSymbols.count(sym)) + if (AllowlistedSymbols.count(sym)) continue; // Remove any existing reference-count binding. state = removeRefBinding(state, sym); Index: clang/lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp =================================================================== --- clang/lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp +++ clang/lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp @@ -94,7 +94,7 @@ // Only perform enum range check on casts where such checks are valid. For // all other cast kinds (where enum range checks are unnecessary or invalid), - // just return immediately. TODO: The set of casts whitelisted for enum + // just return immediately. TODO: The set of casts allowlisted for enum // range checking may be incomplete. Better to add a missing cast kind to // enable a missing check than to generate false negatives and have to remove // those later.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits