#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
#include "clang/StaticAnalyzer/Core/Checker.h"
#include "clang/StaticAnalyzer/Core/CheckerManager.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
usingnamespaceclang;
usingnamespaceento;
namespace {
enum SetPrivilegeFunctionKind { … };
class SetgidSetuidOrderChecker : public Checker<check::PostCall, eval::Assume> { … };
}
REGISTER_TRAIT_WITH_PROGRAMSTATE(…)
REGISTER_TRAIT_WITH_PROGRAMSTATE(…)
void SetgidSetuidOrderChecker::checkPostCall(const CallEvent &Call,
CheckerContext &C) const { … }
ProgramStateRef SetgidSetuidOrderChecker::evalAssume(ProgramStateRef State,
SVal Cond,
bool Assumption) const { … }
void SetgidSetuidOrderChecker::processSetuid(ProgramStateRef State,
const CallEvent &Call,
CheckerContext &C) const { … }
void SetgidSetuidOrderChecker::processSetgid(ProgramStateRef State,
const CallEvent &Call,
CheckerContext &C) const { … }
void SetgidSetuidOrderChecker::processOther(ProgramStateRef State,
const CallEvent &Call,
CheckerContext &C) const { … }
bool SetgidSetuidOrderChecker::isFunctionCalledInArg(
const CallDescription &Desc, const CallEvent &Call) const { … }
void SetgidSetuidOrderChecker::emitReport(ProgramStateRef State,
CheckerContext &C) const { … }
void ento::registerSetgidSetuidOrderChecker(CheckerManager &mgr) { … }
bool ento::shouldRegisterSetgidSetuidOrderChecker(const CheckerManager &mgr) { … }