ClangBuiltLinux / thread-safety-analysis

A research project into applying Clang's Thread Safety Analysis to the Linux Kernel
Other
6 stars 0 forks source link

fs/dcache.c: can't annotate shrink_lock_dentry precisely #124

Open himanshujha199640 opened 5 years ago

himanshujha199640 commented 5 years ago

Similar to: https://github.com/ClangBuiltLinux/thread-safety-analysis/issues/28#issuecomment-496215839 Complex locking and unlocking using nested conditionals.

/home/himanshu/clang-thread-safety-analysis/fs/dcache.c:1040:3: warning: releasing mutex 'dentry->d_lockref...lock' that was not held [-Wthread-safety-analysis]
                spin_unlock(&dentry->d_lock);
                ^
/home/himanshu/clang-thread-safety-analysis/fs/dcache.c:1050:11: warning: mutex 'inode->i_lock' is not held on every path through here [-Wthread-safety-analysis]
        parent = dentry->d_parent;
                 ^
/home/himanshu/clang-thread-safety-analysis/fs/dcache.c:1041:3: note: mutex acquired here
                spin_lock(&inode->i_lock);
                ^
/home/himanshu/clang-thread-safety-analysis/fs/dcache.c:1050:11: warning: mutex 'dentry->d_lockref...lock' is not held on every path through here [-Wthread-safety-analysis]
        parent = dentry->d_parent;
                 ^
/home/himanshu/clang-thread-safety-analysis/fs/dcache.c:1042:3: note: mutex acquired here
                spin_lock(&dentry->d_lock);
                ^
/home/himanshu/clang-thread-safety-analysis/fs/dcache.c:1054:2: warning: releasing mutex 'dentry->d_lockref...lock' that was not held [-Wthread-safety-analysis]
        spin_unlock(&dentry->d_lock);
        ^
/home/himanshu/clang-thread-safety-analysis/fs/dcache.c:1066:6: warning: mutex 'dentry->d_lockref...lock' is not held on every path through here [-Wthread-safety-analysis]
        if (inode)
            ^
/home/himanshu/clang-thread-safety-analysis/fs/dcache.c:1058:3: note: mutex acquired here
                spin_lock(&dentry->d_lock);
                ^
/home/himanshu/clang-thread-safety-analysis/fs/dcache.c:1066:6: warning: mutex 'inode->i_lock' is not held on every path through here [-Wthread-safety-analysis]
        if (inode)
            ^
/home/himanshu/clang-thread-safety-analysis/fs/dcache.c:1041:3: note: mutex acquired here
                spin_lock(&inode->i_lock);
                ^
/home/himanshu/clang-thread-safety-analysis/fs/dcache.c:1066:6: warning: mutex 'dentry->d_lockref...lock' is not held on every path through here [-Wthread-safety-analysis]
        if (inode)
            ^
/home/himanshu/clang-thread-safety-analysis/fs/dcache.c:1042:3: note: mutex acquired here
                spin_lock(&dentry->d_lock);
                ^
/home/himanshu/clang-thread-safety-analysis/fs/dcache.c:1066:6: warning: mutex 'inode->i_lock' is not held on every path through here [-Wthread-safety-analysis]
        if (inode)
            ^
/home/himanshu/clang-thread-safety-analysis/fs/dcache.c:1041:3: note: mutex acquired here
                spin_lock(&inode->i_lock);
                ^
/home/himanshu/clang-thread-safety-analysis/fs/dcache.c:1066:6: warning: mutex 'dentry->d_lockref...lock' is not held on every path through here [-Wthread-safety-analysis]
        if (inode)
            ^
/home/himanshu/clang-thread-safety-analysis/fs/dcache.c:1042:3: note: mutex acquired here
                spin_lock(&dentry->d_lock);
                ^
/home/himanshu/clang-thread-safety-analysis/fs/dcache.c:1067:3: warning: releasing mutex 'inode->i_lock' that was not held [-Wthread-safety-analysis]
                spin_unlock(&inode->i_lock);
                ^