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

Hide mutex structure contents and standard globals in base analysis #746

Merged
merged 7 commits into from
Jul 28, 2022

Conversation

sim642
Copy link
Member

@sim642 sim642 commented May 27, 2022

Split off from #745 (comment).

@michael-schwarz:

I'm a bit worried about having Bot here, as it might make some comparisons of the struct members return false, potentially making both branches unreachable.

@sim642:

Maybe a safer alternative would be like a Struct with no fields? Of course introducing a new Mutex variant to the value domain would be the safest, but I suspect it requires similar hacks as for Thread since there's some unknown structure still being manipulated (and that structure probably is different for OSX).


This is to avoid large amounts of invariants about pthread_mutex_t contents, which are actually all incorrect, since base analysis never updates them from their initialized values. Hiding them from elsewhere (e.g. g2html) would improve readability as well, but so far such mutex type ignoring was only done for accesses, not base.

Additionally, it (optionally) hides unknown globals from standard headers, e.g. __tzname, etc, such that they wouldn't always clutter local states.

@sim642 sim642 force-pushed the base-hide-mutex branch from 2074399 to 2f80c77 Compare July 26, 2022 11:19
@sim642 sim642 changed the title Hide mutex structure contents in base analysis Hide mutex structure contents and standard globals in base analysis Jul 26, 2022
@sim642 sim642 marked this pull request as ready for review July 26, 2022 11:44
@sim642 sim642 requested a review from michael-schwarz July 28, 2022 08:09
Copy link
Member

@michael-schwarz michael-schwarz left a comment

Choose a reason for hiding this comment

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

LGTM! We might want to enhance this mutex data type with information such as whether it is initialized or whether it is recursive at some later point, but this already is a step in the right direction!

src/cdomains/valueDomain.ml Outdated Show resolved Hide resolved
src/cdomains/valueDomain.ml Outdated Show resolved Hide resolved
src/util/options.schema.json Outdated Show resolved Hide resolved
@sim642 sim642 requested a review from jerhard July 28, 2022 09:53
@sim642 sim642 merged commit 8a67872 into master Jul 28, 2022
@sim642 sim642 deleted the base-hide-mutex branch July 28, 2022 12:00
@sim642 sim642 added this to the v2.0.0 milestone Aug 12, 2022
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.

3 participants