diff options
author | Anna Zaks <ganna@apple.com> | 2016-09-20 20:28:50 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2016-09-20 20:28:50 +0000 |
commit | c154f7bc37826dea7846db2d42d61f1172e4876e (patch) | |
tree | 4b31de2002fb9f52221dec67a51cf89137437c57 /llvm/lib/CodeGen/StackProtector.cpp | |
parent | 1290355f5ad38d174abca256d2f55c7b1c09912e (diff) | |
download | llvm-c154f7bc37826dea7846db2d42d61f1172e4876e.zip llvm-c154f7bc37826dea7846db2d42d61f1172e4876e.tar.gz llvm-c154f7bc37826dea7846db2d42d61f1172e4876e.tar.bz2 |
[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
llvm-svn: 282011
Diffstat (limited to 'llvm/lib/CodeGen/StackProtector.cpp')
0 files changed, 0 insertions, 0 deletions