Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect stack storage being initialized multiple times #25

Open
droe opened this issue Dec 21, 2024 · 0 comments
Open

Detect stack storage being initialized multiple times #25

droe opened this issue Dec 21, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@droe
Copy link
Owner

droe commented Dec 21, 2024

When the same stack area is being used as storage for a stack block literal as well as for something else, the plugin gets confused and will fail with a hard to diagnose error, such as:

[ScriptingProvider] Stack block 100004ac0: AssertionError: 
[ScriptingProvider] Traceback (most recent call last):
[ScriptingProvider]   File "/Users/daniel/Library/Application Support/Binary Ninja/plugins/binja-blocks/blocks.py", line 928, in annotate_stack_block_literal
[ScriptingProvider]     bl = BlockLiteral.from_stack(bv, block_literal_insn, block_literal_var, sym_addrs)
[ScriptingProvider]   File "/Users/daniel/Library/Application Support/Binary Ninja/plugins/binja-blocks/blocks.py", line 430, in from_stack
[ScriptingProvider]     return cls(bv, is_stack_block, bl_insn, isa, flags, reserved, invoke, descriptor)
[ScriptingProvider]   File "/Users/daniel/Library/Application Support/Binary Ninja/plugins/binja-blocks/blocks.py", line 448, in __init__
[ScriptingProvider]     assert self.invoke != 0
[ScriptingProvider] AssertionError

Instead of attempting to annotate badly, the plugin should attempt to detect at least some of these situations and refuse to annotate automatically.

Sample: iOS 18.2 /usr/libexec/xpcproxy function at 10000487c has a huge giant mess that we'd like to not touch

Sample: iOS 18.2 /usr/libexec/nanoregistryd function at 10001a2c4 has re-use of the same block literal multiple times that we'd like to keep annotating

@droe droe added the enhancement New feature or request label Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant