Issue 107881
Summary pthread interceptors for ASAN/MSAN
Labels new issue
Assignees
Reporter ccotter
    Common pthread APIs like `pthread_mutex_lock` do not seem to have ASAN or MSAN interceptors. The following program is not caught by ASAN, though it is caught by TSAN with a `ThreadSanitizer: heap-use-after-free` diagnostic.

ASAN and MSAN intercept other libc names and check for the validity of the input parameters. Are the pthread APIs intentionally left out , or should they be added to `sanitizer_common_interceptors.inc` to catch such errors.

```
#include <pthread.h>

int main() {
 pthread_mutex_t* m = new pthread_mutex_t;
  delete m;
 pthread_mutex_lock(m); // No ASAN or MSAN diagnostic. TSAN catches this with heap-use-after-free.
  return 0;
}
```

Stack use after free are not caught by any of the sanitizers.

```
#include <pthread.h>

int main() {
  pthread_mutex_t* m;
  {
 pthread_mutex_t mtx;
    m = &mtx;
  }
  pthread_mutex_lock(m); // ASAN/MSAN hang on my system (but do not give any sanitizer diagnostic). The TSAN program runs without any error.
  return 0;
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to