[analyzer] Add a checker that detects blocks in critical sections

Description

[analyzer] Add a checker that detects blocks in critical sections

This checker should find the calls to blocking functions (for example: sleep, getc, fgets,read,recv etc.) inside a critical section. When sleep(x) is called while a mutex is held, other threads cannot lock the same mutex. This might take some time, leading to bad performance or even deadlock.

Example:

mutex_t m;

void f() {

sleep(1000); // Error: sleep() while m is locked! [f() is called from foobar() while m is locked]
// do some work

}

void foobar() {

lock(m);
f();
unlock(m);

}

A patch by zdtorok (Zoltán Dániel Török)!

Differential Revision: https://reviews.llvm.org/D21506

Details

Committed
zaksSep 20 2016, 1:28 PM
Differential Revision
D21506: [analyzer] Block in critical section
Parents
rL282010: Mark ELF sections whose name start with .note as note
Branches
Unknown
Tags
Unknown