This is an archive of the discontinued LLVM Phabricator instance.

[sancov] Don't instrument calls to bitcast funcs: they're not indirect.
ClosedPublic

Authored by ab on Feb 11 2022, 2:06 PM.

Details

Summary

Currently, when instrumenting indirect calls, this uses
CallBase::getCalledFunction to determine whether a given callsite is
eligible.

However, that returns null if:

this is an indirect function invocation or the function signature
does not match the call signature.

So, we end up instrumenting direct calls where the callee is a bitcast
ConstantExpr, even though we presumably don't need to.

Use isIndirectCall to ignore those funky direct calls.

Diff Detail

Event Timeline

ab created this revision.Feb 11 2022, 2:06 PM
ab requested review of this revision.Feb 11 2022, 2:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 11 2022, 2:06 PM
MaskRay accepted this revision.Feb 24 2022, 4:44 PM

Sorry for the belated response. LGTM.

llvm/test/Instrumentation/SanitizerCoverage/trace-pc-guard.ll
66
67

Delete -NOT. Consecutive -NEXT patterns can ensure there is only one __sanitizer_cov_trace_* call.

This revision is now accepted and ready to land.Feb 24 2022, 4:44 PM
This revision was landed with ongoing or failed builds.Mar 7 2022, 12:44 PM
This revision was automatically updated to reflect the committed changes.
ab marked 2 inline comments as done.
Herald added a project: Restricted Project. · View Herald TranscriptMar 7 2022, 12:44 PM
ab added a comment.Mar 7 2022, 12:44 PM

Thanks!

llvm/test/Instrumentation/SanitizerCoverage/trace-pc-guard.ll
67

Sure; replaced with -NEXT of trace_pc_guard call