Page MenuHomePhabricator

[analyzer] Implement shared semantics checks for XNU functions in PthreadLockChecker
Needs ReviewPublic

Authored by ASDenysPetrov on Sep 4 2020, 8:25 AM.

Details

Summary

Implement shared semantics checks for correct use of XNU functions for shared and exclusive mutexes.

Clarification:
Shared semantics says that if a lock has been acquired as shared, so it shall be released as shared as well. And vice versa, unique(usual) acquisition shall be followed by a unique unlock. This produces so-called pairs "shared-shared" and "unique-unique" Any mixed sequences of "shared-unique" or "unique-shared" are ill-formed and can lead to undefined behavior.

Diff Detail

Event Timeline

ASDenysPetrov created this revision.Sep 4 2020, 8:25 AM

Fixed some missed conditions. Added more tests.

Minor fixes.

It would be nice if someone had time to look at this. Thanks.

It would be nice if someone had time to look at this. Thanks.

I am just looking, but I am not a pthread expert.

It would be nice if someone had time to look at this. Thanks.

I am just looking, but I am not a pthread expert.

Sorry, absolutely no competence.

ASDenysPetrov edited the summary of this revision. (Show Details)Sep 28 2020, 8:50 AM

@baloghadamsoftware

Sorry, absolutely no competence.

That's OK. I've added a clarification section to the summary to make it easier to understand my intentions.