================
@@ -104,15 +146,35 @@ void ChrootChecker::evalChdir(const CallEvent &Call,
CheckerContext &C) const {
R = R->StripCasts();
if (const StringRegion* StrRegion= dyn_cast<StringRegion>(R)) {
const StringLiteral* Str = StrRegion->getStringLiteral();
- if (Str->getString() == "/")
- state = Mgr.addGDM(state, ChrootChecker::getTag(),
- (void*) JAIL_ENTERED);
+ if (Str->getString() == "/") {
+ state = state->set<ChrootState>(JAIL_ENTERED);
+ }
}
}
C.addTransition(state);
}
+const ExplodedNode *ChrootChecker::getAcquisitionSite(const ExplodedNode *N,
+ CheckerContext &C) {
+ ProgramStateRef State = N->getState();
+ // When bug type is resource leak, exploded node N may not have state info
+ // for leaked file descriptor, but predecessor should have it.
+ if (!State->get<ChrootCall>())
+ N = N->getFirstPred();
----------------
vabridgers wrote:
Your comments have inspired different thoughts about how to address the problem
I'm wanting to solve. Basically, when the checker detects an unexpected use of
chdir() I need information about where chroot() was use prior for a detailed
and useful warning message. You probably recognize, but I reused design/use
patterns from the stream checker that seemed close to what I want. The solution
can evolve of course. Thanks for your comments.
https://github.com/llvm/llvm-project/pull/117791
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits