[compiler-rt] r325585 - Stop intercepting forkpty(3) and openpty(3) on NetBSD
Kamil Rytarowski via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 20 07:43:07 PST 2018
Author: kamil
Date: Tue Feb 20 07:43:07 2018
New Revision: 325585
URL: http://llvm.org/viewvc/llvm-project?rev=325585&view=rev
Log:
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
Modified:
compiler-rt/trunk/lib/msan/msan_interceptors.cc
Modified: compiler-rt/trunk/lib/msan/msan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_interceptors.cc?rev=325585&r1=325584&r2=325585&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/msan/msan_interceptors.cc Tue Feb 20 07:43:07 2018
@@ -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,
}
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,
__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;
}
More information about the llvm-commits
mailing list