Vector35 / Vector35/binaryninja-api
Optimized modulus using a combination of divide and shifted multiply with masking of low bits fails to simplify
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.3k
- Forks
- 298
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 19
Description
Optimized modulus that combines the steps of an optimized divide with a multiplication using shifts, adds,
and masking of lower bits can fail to simplify into a modulus expression. An example is given below:
Binaries with examples:
u32_mod_4k_x86.so: See 3, 5, 17, 36, and others
u64_mod_4k_arm64.so: See 3, 5, 9, 11, 17, and others
u64_mod_4k_x64.dylib: See 6, 10, 12, 18, 20, and others
u64_mod_4k_x64.so: See 3, 5, 9, 17, 22, and others
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.
Research direction
Reproduce the failure using combined_with_mask.zip, checking the listed cases in u32_mod_4k_x86.so, u64_mod_4k_arm64.so, u64_mod_4k_x64.dylib, and u64_mod_4k_x64.so. Trace the simplification of the optimized divide, shifted multiply, adds, and low-bit mask, and verify that the affected patterns simplify into a modulus expression.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers, reverse-engineering
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100