From 6897111231e7be8886fedc7d6ab02436a901323d Mon Sep 17 00:00:00 2001 From: Ilya Leoshkevich Date: Fri, 3 Apr 2020 15:15:06 +0200 Subject: [PATCH] [MSan] Add COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED Summary: MSan not implementing COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED looks like an omission - this macro makes it possible for those intercepted functions, which libc needs very early, to work before interceptors are initialized (i.e. before REAL() is usable). While currently there are no observable practical problems in this area, changes in libc or in MSan runtime may provoke them. Therefore, change MSan to work like ASan and TSan already do - use internal functions in certain interceptors when initialization is not complete. Reviewers: eugenis, vitalybuka Reviewed By: eugenis Subscribers: #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D76969 --- compiler-rt/lib/msan/msan_interceptors.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler-rt/lib/msan/msan_interceptors.cpp b/compiler-rt/lib/msan/msan_interceptors.cpp index 9b1340b..6459c7a 100644 --- a/compiler-rt/lib/msan/msan_interceptors.cpp +++ b/compiler-rt/lib/msan/msan_interceptors.cpp @@ -1304,6 +1304,8 @@ int OnExit() { ForEachMappedRegion(map, __msan_unpoison); \ } while (false) +#define COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED (!msan_inited) + #define COMMON_INTERCEPTOR_GET_TLS_RANGE(begin, end) \ if (MsanThread *t = GetCurrentThread()) { \ *begin = t->tls_begin(); \ -- 2.7.4