Vector35 / Vector35/binaryninja-api

Binary Ninja uses too-low buffer size when reading bndb

Open
#6,421 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Database Effort: Medium Impact: Medium
Dominant language
C++
Stars
1.3k
Forks
298
Avg merge
5d 5h
Merged PRs (30d)
19

Description

Version and Platform (required):

  • Binary Ninja Version: 4.3.6879-dev (333734f4)
  • OS: macOS
  • OS Version: 15.3 (24D60)
  • CPU Architecture: Apple M3 Max

Bug Description:
One of my bndbs has grown to 11GB. I've noticed that when I open the bndb, Binary Ninja spends almost 30 seconds just calling pread to load the bndb into memory. During this time, the UI is frozen. For the pread calls, the offsets are not always sequential but often are, while the read size is always 1024 bytes.

1024 bytes seems like way too low a read size. Here is a simplistic comparison using dd (although this is sequential):

% dd if=main_301.bndb of=/dev/null bs=1024 
[..]
11609607168 bytes transferred in 13.495961 secs (860228269 bytes/sec)
% dd if=main_301.bndb of=/dev/null bs=1048576
[..]
11609607168 bytes transferred in 0.684243 secs (16967082116 bytes/sec)

(After this phase of loading is done, the UI becomes responsive again and Binary Ninja starts using CPU on multiple threads while the progress bar ticks up.)

Consider implementing some sort of cache so that you can use a larger read size… or just use mmap.

Also consider fixing the UI to not be unresponsive while reading data.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the bndb loading path and its 1024-byte pread calls; the issue names no source files or tests. Compare larger reads or mmap while checking how loading affects UI responsiveness. Done means large bndb files load without excessive tiny reads and the UI does not remain frozen during the read phase.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
performance, reverse-engineering
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.