diff options
author | Alexey Samsonov <vonosmas@gmail.com> | 2016-03-11 00:45:49 +0000 |
---|---|---|
committer | Alexey Samsonov <vonosmas@gmail.com> | 2016-03-11 00:45:49 +0000 |
commit | 967630ad7779fb5fb99ea1136077713e998273fe (patch) | |
tree | 8b7d3fe0f254ca0634a102bdf4e59ee3a6304b7f /lib/asan/asan_interceptors.cc | |
parent | 2ecf56ae0f38070dec05ef601ab0ab35320fe615 (diff) | |
download | compiler-rt-967630ad7779fb5fb99ea1136077713e998273fe.tar.gz |
[sanitizer] Add strlen to the common interceptors
Summary:
Adds strlen to the common interceptors, under a new common flag
intercept_strlen. This provides better sharing of interception code among
sanitizers and cleans up the inconsistent type declarations of the
previously duplicated interceptors.
Removes the now-duplicate strlen interceptor from asan, msan, and tsan.
The entry check semantics are normalized now for msan and asan, whose
private strlen interceptors contained multiple layers of checks that
included impossible-to-reach code. The new semantics are identical to the
old: bypass interception if in the middle of init or if both on Mac and not
initialized; else, call the init routine and proceed.
Patch by Derek Bruening!
Reviewers: samsonov, vitalybuka
Subscribers: llvm-commits, kcc, zhaoqin
Differential Revision: http://reviews.llvm.org/D18020
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@263177 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/asan_interceptors.cc')
-rw-r--r-- | lib/asan/asan_interceptors.cc | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/lib/asan/asan_interceptors.cc b/lib/asan/asan_interceptors.cc index faac15b32..4a10afcc1 100644 --- a/lib/asan/asan_interceptors.cc +++ b/lib/asan/asan_interceptors.cc @@ -580,23 +580,6 @@ INTERCEPTOR(char*, strdup, const char *s) { } #endif -INTERCEPTOR(SIZE_T, strlen, const char *s) { - void *ctx; - ASAN_INTERCEPTOR_ENTER(ctx, strlen); - if (UNLIKELY(!asan_inited)) return internal_strlen(s); - // strlen is called from malloc_default_purgeable_zone() - // in __asan::ReplaceSystemAlloc() on Mac. - if (asan_init_is_running) { - return REAL(strlen)(s); - } - ENSURE_ASAN_INITED(); - SIZE_T length = REAL(strlen)(s); - if (flags()->replace_str) { - ASAN_READ_RANGE(ctx, s, length + 1); - } - return length; -} - INTERCEPTOR(SIZE_T, wcslen, const wchar_t *s) { void *ctx; ASAN_INTERCEPTOR_ENTER(ctx, wcslen); @@ -763,7 +746,6 @@ void InitializeAsanInterceptors() { ASAN_INTERCEPT_FUNC(strcat); // NOLINT ASAN_INTERCEPT_FUNC(strchr); ASAN_INTERCEPT_FUNC(strcpy); // NOLINT - ASAN_INTERCEPT_FUNC(strlen); ASAN_INTERCEPT_FUNC(wcslen); ASAN_INTERCEPT_FUNC(strncat); ASAN_INTERCEPT_FUNC(strncpy); |