[PATCH] D43490: Stop intercepting forkpty(3) and openpty(3) on NetBSD
Kamil Rytarowski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 19 15:10:58 PST 2018
krytarowski created this revision.
krytarowski added reviewers: joerg, vitalybuka.
krytarowski added a project: Sanitizers.
krytarowski added a comment.
This also covers FreeBSD.
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>
Repository:
rL LLVM
https://reviews.llvm.org/D43490
Files:
lib/msan/msan_interceptors.cc
Index: lib/msan/msan_interceptors.cc
===================================================================
--- lib/msan/msan_interceptors.cc
+++ lib/msan/msan_interceptors.cc
@@ -1182,6 +1182,9 @@
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 @@
}
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 @@
__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 @@
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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43490.134981.patch
Type: text/x-patch
Size: 1431 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180219/bb38c1d8/attachment.bin>
More information about the llvm-commits
mailing list