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 | 83eb8a52f9e739adfde4d248b5a985f37cc2325b (patch) | |
tree | 06f0387fb163d83213ca55e8d06f8067ba56d992 /lib/sanitizer_common/sanitizer_platform_limits_posix.h | |
parent | 5f9ceb98e38aa371b74a803184d398fc31d4b14e (diff) |
[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.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@250113 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_platform_limits_posix.h')
-rw-r--r-- | lib/sanitizer_common/sanitizer_platform_limits_posix.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/lib/sanitizer_common/sanitizer_platform_limits_posix.h index a2d01e2f6..c598fe0d7 100644 --- a/lib/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.h @@ -150,6 +150,18 @@ namespace __sanitizer { }; const unsigned old_sigset_t_sz = sizeof(unsigned long); + + struct __sanitizer_sem_t { +#if SANITIZER_ANDROID && defined(_LP64) + int data[4]; +#elif SANITIZER_ANDROID && !defined(_LP64) + int data; +#elif SANITIZER_LINUX + uptr data[4]; +#elif SANITIZER_FREEBSD + u32 data[4]; +#endif + }; #endif // SANITIZER_LINUX || SANITIZER_FREEBSD #if SANITIZER_ANDROID |