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

Bitfield Domain #1623

Merged
merged 244 commits into from
Feb 14, 2025
Merged

Bitfield Domain #1623

merged 244 commits into from
Feb 14, 2025

Conversation

ManuelLerchner
Copy link
Contributor

@ManuelLerchner ManuelLerchner commented Nov 5, 2024

Overview

This pull request enhances the existing IntDomain by introducing a new BitfieldDomain. The full IntDomain now consists of (DefExc, Interval, Enums, Congruence, IntervalSet, Bitfield).

The new Bitfield Domain is based on the Paper Abstract Domains for Bit-Level Machine Integer and Floating-Point Operations , and keeps track of each bit in an integer individually (conceptually, this is similar to a boolean lattice for each bit).
This allows for very precise analysis of bitwise operations.

The new domain can be enabled with --enable ana.int.bitfield

Example

For example, joining $of\_int(8) \sqcup of\_int(10) \equiv 0b1000 \sqcup 0b1010 = 0b10?0$ maintains most information about the bits; only the second bit differs in both numbers and therefore becomes unknown (unknown bits are shown using a question-mark symbol).
In this case, no over-approximation happens and the join is exact.

Bitwise operators such as &, |, <<, >>, ~, ... can now deal with this information very precisely.

Refinements

As the existing IntDomain allows for mutual refinements of the subdomains, this PR also adds all newly possible refinement directions to improve precision in the IntDomain.

We did, however, have some problems with non-termination when using refinements.
Some of these issues are however also present on the master branch, and indicate a more fundamental problem with refinements (See #1671).


Note

This implementation is part of the Automated Bug Hunting and Beyond practical course at TUM.

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semgrep OSS found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@sim642
Copy link
Member

sim642 commented Feb 13, 2025

Thanks for addressing my comments! I think I'm now satisfied.

There are some unresolved comments from @michael-schwarz and @jerhard among the hundreds of "hidden items" above. So before merging those should be still considered. Just nothing it here since they're hidden by default and thus easy to miss.

@michael-schwarz
Copy link
Member

The old ones were almost all addressed, I closed them.

The open one is this one #1623 (comment) and the one about refine I just made. Once these two are addressed, I think it is ready to be merged.

Great job everyone 💯 🎉 🎉

@michael-schwarz michael-schwarz merged commit 2ecd762 into goblint:master Feb 14, 2025
12 checks passed
michael-schwarz added a commit that referenced this pull request Feb 14, 2025
@sim642 sim642 added this to the v2.6.0 milestone Feb 14, 2025
@sim642 sim642 mentioned this pull request Feb 18, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants