Skip to content

Commit

Permalink
[MSan] Add COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED
Browse files Browse the repository at this point in the history
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
  • Loading branch information
iii-i committed Apr 3, 2020
1 parent 40fc3de commit 6897111
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compiler-rt/lib/msan/msan_interceptors.cpp
Expand Up @@ -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(); \
Expand Down

0 comments on commit 6897111

Please sign in to comment.