[PATCH] D15287: [tsan] Fix memcmp interceptor to correctly use COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED
Kuba Brecka via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 7 05:29:12 PST 2015
kubabrecka created this revision.
kubabrecka added reviewers: dvyukov, samsonov, glider, kcc.
kubabrecka added subscribers: llvm-commits, zaks.anna.
The `memcmp` interceptor checks COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED only after it calls COMMON_INTERCEPTOR_ENTER, which causes an early process launch crash when running TSan in iOS simulator. Let's fix this by checking COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED as the very first thing in the interceptor.
http://reviews.llvm.org/D15287
Files:
lib/sanitizer_common/sanitizer_common_interceptors.inc
Index: lib/sanitizer_common/sanitizer_common_interceptors.inc
===================================================================
--- lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -403,10 +403,10 @@
const void *s1, const void *s2, uptr n)
INTERCEPTOR(int, memcmp, const void *a1, const void *a2, uptr size) {
- void *ctx;
- COMMON_INTERCEPTOR_ENTER(ctx, memcmp, a1, a2, size);
if (COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED)
return internal_memcmp(a1, a2, size);
+ void *ctx;
+ COMMON_INTERCEPTOR_ENTER(ctx, memcmp, a1, a2, size);
CALL_WEAK_INTERCEPTOR_HOOK(__sanitizer_weak_hook_memcmp, GET_CALLER_PC(), a1,
a2, size);
if (common_flags()->intercept_memcmp) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15287.42060.patch
Type: text/x-patch
Size: 812 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151207/37908368/attachment.bin>
More information about the llvm-commits
mailing list