Fraunhofer-AISEC / cpg

A library to extract Code Property Graphs from C/C++, Java, Go, Python, Ruby and every other language through LLVM-IR.
https://fraunhofer-aisec.github.io/cpg/
Apache License 2.0
246 stars 59 forks source link

`DynamicInvokeResolver` runs in parallel to `ControlFlowSensitiveDFGPass` #1531

Closed konradweiss closed 3 weeks ago

konradweiss commented 1 month ago

DynamicInvokeResolver runs in parallel with ControlFlowSensitiveDFGPass, but uses DFG edges and should IMO run either before or after (i think before). However, currently we don't have a way to specify an optional dependency, i.e. a dependency saying that the pass should run after the other, only if it was specified to run @RunAfter(ControlFlowSensitiveDFGPass::class) or a grouping of passes by semantic @RunAfter(DFG) and DFG = [DFGPass, ControlFlowSensitiveDFGPass].

KuechA commented 1 month ago

The normal DFGPass also adds DFG edges and the DynamicInvokeResolver depends on this one already. The ControlFlowSensitiveDFGPass basically makes the edges better, so it could make sense to add a soft dependency on this pass too? There's a difference between using the Annotation as @DependsOn(ControlFlowSensitiveDFGPass, false) (default and would always register the ControlFlowSensitiveDFGPass) and @DependsOn(DynamicInvokeResolver, true) (wouldn't register the pass on its own but only enforces the order if the user added this pass). So, I think using the second version to annotate the DynamicInvokeResolver would do what you want.

konradweiss commented 1 month ago

ah perfect, I did forget that we had that functionality already implemented somewhere.