Skip to content

Always save disassembly metrics - #263

Merged
sipma merged 3 commits into
static-analysis-engineering:masterfrom
waskyo:always_save_disassembly_metrics
Nov 2, 2026
Merged

sipma merged 3 commits into
static-analysis-engineering:masterfrom
waskyo:always_save_disassembly_metrics

Conversation

@waskyo

@waskyo waskyo commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Before this change we would only save disassembly metrics when doing full
analysis, now we also save them when doing only disassembly. This allows us
to evaluate how problematic a binary may be without spending too much
effort.

Along the way discovered that the XML files generated in bCHFileIO.ml had
a slightly different structure from the rest. It's not clear why, the differences
seem to be cosmetic, so in the interest of parity I nuked the duplicated
get_bch_root from that file. The first commit in the PR has more details.

Most of the CHB code uses the method defined in
CHB/bchlib/bCHPreFileIO.ml but the code in CHB/bchanalyze/bCHFileIO.ml
was using its own version.

The differences are:
- The standard puts the binary information in the header itself
whereas this one adds an application node under the header, and adds the
binary information there.
- The standard one includes chb-date and chb-version fields.
- The standard one calls the root node "codehawk-binary-analyzer"
whereas this one calls it "codehawk-binary-analysis".

As an example, the header for xml generated from within bCHFileIO.ml
used to be:
```
<codehawk-binary-analysis>
  <header>
    <application info="disassembly-status" name="binary.exe" time="2026-10-28 15:54:38"/>
  </header>
  ...
</codehawk-binary-analysis>
```

And now it is:
```
<codehawk-binary-analyzer>
  <header chb-date="2026-10-01" chb-version="0.6.0_20261001" info="disassembly-status" name="binary.exe" time="2026-10-28 19:48:18"/>
  ...
</codehawk-binary-analyzer>
```

@sipma sipma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Always saving the disassembly metrics is a good idea.

The metrics are saved to s/<binary>_disassembly.xml.

The change to CHB/bchanalyze/bCHFileIO.ml is needed, otherwise the
metrics will always be overwritten by the ones from x86 (even if
you're not analyzing x86).

I went ahead and did this for all architectures.

We decided not to gate this by -save_disassembly_status_in_xml since
that is only used for X86/PE and the python side of things never
passes this command line argument.
@waskyo
waskyo force-pushed the always_save_disassembly_metrics branch from 21a6526 to fe4e7fa Compare November 2, 2026 15:07
@sipma
sipma merged commit bef6f0f into static-analysis-engineering:master Nov 2, 2026
3 checks passed
@waskyo
waskyo deleted the always_save_disassembly_metrics branch November 2, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants