[WARP] relocatable_regions is very expensive with a large number of segments / sections
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Domain
- performance, reverse-engineering
Research direction
Start in plugins/warp/src/lib.rs at relocatable_regions, especially the linked lines calling BinaryView::GetSectionsAt and BinaryViewExt::segments. Reproduce with a large iOS shared cache using the listed load and analysis steps, then profile with sample binaryninja. Done means the relocatable_regions bottleneck is reduced for the reported segment and section scale without changing analysis results.
Written by the indexing model from the issue text.
Description
Version and Platform (required):
- Binary Ninja Version: 5.3.9417-dev Ultimate, 8f260d72
- OS: macos
- OS Version: 26.3.1
- CPU Architecture: arm64
Bug Description:
I've been testing analysis performance with a full iOS shared cache loaded to look for scalability bottlenecks. This has 4,207 images loaded from the shared cache, with 22,222 segments, 132,809 sections, over 15 million functions, and 31 million symbols.
One bottleneck I noticed is in WARP's relocatable_regions:
Specifically, this calls BinaryView::GetSectionsAt for each segment in the binary. Since there are many threads running this same activity in parallel, this leads to heavy contention on the lock used internally for the atomic accesses to BinaryView::m_sectionMap.
Steps To Reproduce:
- Open a shared cache with an initial analysis hold.
- Select all images in the shared cache image list, and hit Load Selected.
- Wait the 5-10 minutes for them to load.
- Clear the analysis hold.
- Once RTTI scanning and disassembly have concluded and we reach phase 1 of analysis, run
sample binaryninjato observe where CPU time is being spent.
Additional Information:
Even the call to BinaryViewExt::segments is relatively expensive in this context since the underlying core C API must allocate a ~175KB buffer to hold the array of segment pointers, and then increment each of their ref counts.
- Dominant language
- C++
- Stars
- 1.3k
- Forks
- 298
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 19
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Vector35/binaryninja-api
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
Vector35/binaryninja-api#8540 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Vector35/binaryninja-api#8516 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
Vector35/binaryninja-api#8503 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Vector35/binaryninja-api#8446 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Vector35/binaryninja-api#8444 ·
All issues in Vector35/binaryninja-api
Similar issues
-
Website Doc Typo Open
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 1/5 1-3 hours Newbie friendliness 92/100
autowarefoundation/autoware_universe#13413 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
automated-analysis bug memory-safety
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100