draperlaboratory / cbat_tools

Program analysis tools developed at Draper on the CBAT project.
MIT License
102 stars 14 forks source link

value set analysis runtime error with bap2 #306

Open zhouxuan009 opened 3 years ago

zhouxuan009 commented 3 years ago

Value set analysis with bap2 still raise an error at runtime and the error message is as below

The pass "value-set" failed with:
source tid does not represent block

I found that the error is triggered because the cfg of subroutine passed to the fixpoint function has @start-pseudo-node and @exit-pseudo-node https://github.com/draperlaboratory/cbat_tools/blob/ce7b339976e00857922222cedc9c58d4c3cfbd55/vsa/value_set/lib/src/cbat_vsa.ml#L449 Just as the bap document says, as toval to_graph : t -> Graphs.Tid.t, since 2.1 the returned graph contains two pseudo-nodes(http://binaryanalysisplatform.github.io/bap/api/odoc/bap/Bap/Std/Sub/index.html)

Then the code below fails to recognize the pseudo node as basic blocks. https://github.com/draperlaboratory/cbat_tools/blob/ce7b339976e00857922222cedc9c58d4c3cfbd55/vsa/value_set/lib/src/cbat_vsa.ml#L391

I am trying to fix this error. But I can't find any api which can remove the pseudo nodes in cfg