- 
                Notifications
    You must be signed in to change notification settings 
- Fork 84
MayLock Analysis & Sanity Checks of Mutex Usage & Analysis of Mutex Types #839
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
          
     Merged
      
      
    
  
     Merged
                    Changes from 1 commit
      Commits
    
    
            Show all changes
          
          
            57 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      52de056
              
                Simplify Lockset
              
              
                michael-schwarz dde2b1a
              
                Steps
              
              
                michael-schwarz c982337
              
                Add case where no warning should be issued
              
              
                michael-schwarz 37155af
              
                More tests
              
              
                michael-schwarz 24c7563
              
                Rm spurious code
              
              
                michael-schwarz 06f98a9
              
                Adapt comments
              
              
                michael-schwarz 28dc103
              
                Cleanup test
              
              
                michael-schwarz 575cb54
              
                Add warning if MayLockset is not empty
              
              
                michael-schwarz 430c376
              
                Account for returning from thread via pthread_exit
              
              
                michael-schwarz f471f47
              
                Add warning when unlocking mutex that may not held
              
              
                michael-schwarz 014481e
              
                Rudimentary, flow-insensitive analysis of mutex types
              
              
                michael-schwarz 8ccfb9e
              
                Fix indentation
              
              
                michael-schwarz 15131fe
              
                Add test for recurisve mutexes
              
              
                michael-schwarz 1c17d61
              
                Track value of mutexAttrT locally
              
              
                michael-schwarz 5f32337
              
                Add mutex type tracking for local mutexes
              
              
                michael-schwarz 6236e48
              
                Skip 60/05 on OS X
              
              
                michael-schwarz e8b09f1
              
                Category for Double Locking
              
              
                michael-schwarz 95f249a
              
                OS X :(
              
              
                michael-schwarz afd4153
              
                Merge branch 'master' into issue_718
              
              
                michael-schwarz 32257f8
              
                Merge branch 'master' into issue_718
              
              
                michael-schwarz 8dc1e84
              
                Merge branch 'master' into issue_718
              
              
                michael-schwarz ee4b452
              
                Merge branch 'master' into issue_718
              
              
                michael-schwarz 53112a0
              
                Dynamically lookup constants
              
              
                michael-schwarz 99f4261
              
                Cleanup
              
              
                michael-schwarz 792e4ec
              
                Make conditions more clear
              
              
                michael-schwarz 208fcf1
              
                Slim down tests by removing unused code
              
              
                michael-schwarz bab294b
              
                Only trace if tracing is enabled
              
              
                michael-schwarz e8d0219
              
                Finally fix it for OS X
              
              
                michael-schwarz 7e91913
              
                Merge branch 'master' into issue_718
              
              
                michael-schwarz 5d82c5c
              
                Fix compilation warnings for test cases with GCC.
              
              
                jerhard ca53009
              
                Merge branch 'master' into issue_718
              
              
                michael-schwarz 01fb38a
              
                Warning for unlocking definitely not-held mutex
              
              
                michael-schwarz 282b671
              
                Add comments about other types of mutexes
              
              
                michael-schwarz 97713d3
              
                Add further dynamic mutex
              
              
                michael-schwarz 3a813de
              
                Change queries, fix unlock for recursive mutexes
              
              
                michael-schwarz b548422
              
                Adapt tests to correct maylockset
              
              
                michael-schwarz cc95869
              
                Fix test 09
              
              
                michael-schwarz 283ec75
              
                Merge branch 'master' into issue_718
              
              
                michael-schwarz 3d064ce
              
                Make example smaller
              
              
                michael-schwarz e7e15fa
              
                Fix whitespace
              
              
                michael-schwarz 550c4f3
              
                Style improvement
              
              
                michael-schwarz f90bbd7
              
                Indentation
              
              
                michael-schwarz aa29d4c
              
                Indentation
              
              
                michael-schwarz 1b0ffc4
              
                Fix annotation
              
              
                michael-schwarz 9f99115
              
                Comments on why 71/07 contains no assertions.
              
              
                michael-schwarz 52c701f
              
                Fix test 71/08 on OS X which doesn't define some constants
              
              
                michael-schwarz fec7dd3
              
                71/07: Do not include pthread.h so OS X tests can have asserts
              
              
                michael-schwarz 5758ff7
              
                Ensure `MutexAttr` survives joins
              
              
                michael-schwarz fe5c49f
              
                Support for Lvals
              
              
                michael-schwarz eeb11fa
              
                Support mutexes in structs also for assignments
              
              
                michael-schwarz be5432c
              
                Add comment
              
              
                michael-schwarz fbc3df4
              
                Cleanup
              
              
                michael-schwarz e5c290a
              
                Merge branch 'master' into issue_718
              
              
                michael-schwarz f2fe2bc
              
                derive compare for MutexType
              
              
                michael-schwarz 48f154a
              
                Use bespoke V, reduce boilerplate
              
              
                michael-schwarz 655c1be
              
                Simplify
              
              
                michael-schwarz 01b9841
              
                Attempt at reuse
              
              
                michael-schwarz File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| // PARAM: --set ana.activated[+] 'maylocks' --set ana.activated[+] 'pthreadMutexType' | ||
| #define _GNU_SOURCE | ||
| #include<pthread.h> | ||
| #include<stdio.h> | ||
| #include<unistd.h> | ||
| #include <assert.h> | ||
|  | ||
|  | ||
| int g; | ||
|  | ||
| struct s { | ||
| pthread_mutex_t m; | ||
| }; | ||
|  | ||
| typedef struct s s_t; | ||
|  | ||
| s_t mut = { PTHREAD_MUTEX_INITIALIZER }; | ||
|  | ||
| #ifndef __APPLE__ | ||
| s_t mut2 = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP }; | ||
| #endif | ||
|  | ||
|  | ||
| void* f1(void* ptr) { | ||
| int top; | ||
|  | ||
| g = 1; | ||
| if(top) { | ||
| pthread_mutex_lock(&mut.m); | ||
| } | ||
| pthread_mutex_lock(&mut.m); //WARN | ||
| pthread_mutex_unlock(&mut.m); | ||
| return NULL; | ||
| } | ||
|  | ||
|  | ||
| int main(int argc, char const *argv[]) | ||
| { | ||
| pthread_t t1; | ||
| pthread_t t2; | ||
|  | ||
| pthread_create(&t1,NULL,f1,NULL); | ||
| pthread_join(t1, NULL); | ||
|  | ||
| #ifndef __APPLE__ | ||
| pthread_mutex_lock(&mut2.m); //NOWARN | ||
| pthread_mutex_lock(&mut2.m); //NOWARN | ||
| pthread_mutex_unlock(&mut2.m); | ||
| pthread_mutex_unlock(&mut2.m); | ||
| #endif | ||
|  | ||
| return 0; | ||
| } | 
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.