diff options
| author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2015-10-12 21:32:30 +0000 |
|---|---|---|
| committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2015-10-12 21:32:30 +0000 |
| commit | f4ebc08831d0a42d8ef455c5b773da888d957087 (patch) | |
| tree | cf5277d91ccac5023f8eaf9ac2537c1f6f0ad3ab /compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc | |
| parent | 9e593499b91261d85f35eb6187369e11529aa12d (diff) | |
| download | bcm5719-llvm-f4ebc08831d0a42d8ef455c5b773da888d957087.tar.gz bcm5719-llvm-f4ebc08831d0a42d8ef455c5b773da888d957087.zip | |
[asan] Zero initialize sem_t in sem_init.
Old version of sem_init (GLIBC_2.0) fails to initialize parts of
sem_t that are used in sem_timedwait. This is fixed in GLIBC_2.1,
but since ASan interceptors downgrade sem_* to the oldest available
version, this can introduce bugs that are only present in sanitized
build. Workaround by zero-initializing sem_t in sem_init.
llvm-svn: 250113
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc')
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc index 5f98099d1ce..9cfaec5cc8e 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc @@ -122,6 +122,7 @@ # if defined(__mips64) || defined(__aarch64__) # include <asm/ptrace.h> # endif +# include <semaphore.h> #endif #if !SANITIZER_ANDROID @@ -1241,4 +1242,8 @@ CHECK_SIZE_AND_OFFSET(cookie_io_functions_t, seek); CHECK_SIZE_AND_OFFSET(cookie_io_functions_t, close); #endif +#if SANITIZER_LINUX || SANITIZER_FREEBSD +CHECK_TYPE_SIZE(sem_t); +#endif + #endif // SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_MAC |

