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

Missing context in Rust binary_op_lifter! to check for correct size of expressions #5913

Open
fuzyll opened this issue Sep 9, 2024 · 0 comments
Assignees
Labels
Component: Rust API Issue needs changes to the Rust API Effort: Medium Issue should take < 1 month Impact: High Issue adds or blocks important functionality Type: Bug Issue is a non-crashing bug with repro steps
Milestone

Comments

@fuzyll
Copy link
Contributor

fuzyll commented Sep 9, 2024

Version and Platform (required):

  • Binary Ninja Version: 4.2.6025-dev

Bug Description:
In the Rust API, there are macros like binary_op_lifter! that are very strict about size checking. If you get it wrong, it will print something like this as a warning each time it's lifted incorrectly:

il @ {:x} attempted to lift 4 byte expression builder as 0 bytes

This is very helpful when you are lifting as it can help you catch potential errors. Unfortunately, it's incredibly pedantic and isn't expressive enough for certain architectures. This means you can wind up with a ton of these messages and no way to resolve them when lifting.

The best example of this is in C-SKY comparison instructions (cmp_{e,ne,slt,ult...}) where binary_op_lifter! treats the two source expressions and the destination instruction as the same size. This works in a lot of cases, but here the output of the cmp is fed into a set_flag operation that expects a size of 0. As a result, the warning is completely unavoidable.

@fuzyll fuzyll added Type: Bug Issue is a non-crashing bug with repro steps Impact: High Issue adds or blocks important functionality Effort: Medium Issue should take < 1 month Component: Rust API Issue needs changes to the Rust API labels Sep 9, 2024
@fuzyll fuzyll added this to the Frogstar milestone Sep 9, 2024
@emesare emesare self-assigned this Sep 9, 2024
@plafosse plafosse modified the milestones: Frogstar, Gallifrey Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Rust API Issue needs changes to the Rust API Effort: Medium Issue should take < 1 month Impact: High Issue adds or blocks important functionality Type: Bug Issue is a non-crashing bug with repro steps
Projects
None yet
Development

No branches or pull requests

3 participants