diff options
author | Kamil Rytarowski <n54@gmx.com> | 2018-02-20 15:43:07 +0000 |
---|---|---|
committer | Kamil Rytarowski <n54@gmx.com> | 2018-02-20 15:43:07 +0000 |
commit | 0fcd67b944d6c2365272280bcff615adf0349673 (patch) | |
tree | 7461cc2bb8fc8906fa7b52e8f56414c0f57d0bba /lib/msan | |
parent | 036ea90152b1ecfca472974fb2a8835c2d596183 (diff) |
Stop intercepting forkpty(3) and openpty(3) on NetBSD
Summary:
forkpty(3) and openpty(3) are part of `-lutil` and we don't intend to reimplement
this system library in sanitizers. Everybody using these functions will need to use
a precompiled library against MSan or other desired sanitizer.
Restrict these functions to Linux-only.
Sponsored by <The NetBSD Foundation>
Reviewers: joerg, vitalybuka
Reviewed By: vitalybuka
Subscribers: llvm-commits, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D43490
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@325585 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/msan')
-rw-r--r-- | lib/msan/msan_interceptors.cc | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/msan/msan_interceptors.cc b/lib/msan/msan_interceptors.cc index 43a2bdcf6..110886494 100644 --- a/lib/msan/msan_interceptors.cc +++ b/lib/msan/msan_interceptors.cc @@ -1182,6 +1182,9 @@ INTERCEPTOR(int, fork, void) { return pid; } +// NetBSD ships with openpty(3) in -lutil, that needs to be prebuilt explicitly +// with MSan. +#if SANITIZER_LINUX INTERCEPTOR(int, openpty, int *amaster, int *aslave, char *name, const void *termp, const void *winp) { ENSURE_MSAN_INITED(); @@ -1193,7 +1196,14 @@ INTERCEPTOR(int, openpty, int *amaster, int *aslave, char *name, } return res; } +#define MSAN_MAYBE_INTERCEPT_OPENPTY INTERCEPT_FUNCTION(openpty) +#else +#define MSAN_MAYBE_INTERCEPT_OPENPTY +#endif +// NetBSD ships with forkpty(3) in -lutil, that needs to be prebuilt explicitly +// with MSan. +#if SANITIZER_LINUX INTERCEPTOR(int, forkpty, int *amaster, char *name, const void *termp, const void *winp) { ENSURE_MSAN_INITED(); @@ -1203,6 +1213,10 @@ INTERCEPTOR(int, forkpty, int *amaster, char *name, const void *termp, __msan_unpoison(amaster, sizeof(*amaster)); return res; } +#define MSAN_MAYBE_INTERCEPT_FORKPTY INTERCEPT_FUNCTION(forkpty) +#else +#define MSAN_MAYBE_INTERCEPT_FORKPTY +#endif struct MSanInterceptorContext { bool in_interceptor_scope; @@ -1678,8 +1692,8 @@ void InitializeInterceptors() { INTERCEPT_FUNCTION(__cxa_atexit); INTERCEPT_FUNCTION(shmat); INTERCEPT_FUNCTION(fork); - INTERCEPT_FUNCTION(openpty); - INTERCEPT_FUNCTION(forkpty); + MSAN_MAYBE_INTERCEPT_OPENPTY; + MSAN_MAYBE_INTERCEPT_FORKPTY; inited = 1; } |