[PATCH] D42050: Intercept tzset in MSan on NetBSD
Kamil Rytarowski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 15 00:07:21 PST 2018
krytarowski created this revision.
krytarowski added reviewers: eugenis, vitalybuka, joerg.
krytarowski added a project: Sanitizers.
Herald added subscribers: kristof.beyls, aemerson.
Handle function renaming tzset -> __tzset50 on NetBSD.
Reset arguments passed to tzset() as it does not accept
input parameters.
The tzset() syscall must be called on NetBSD with
InterceptorScope. Once a user sets timezone (either
by TZ or /etc/localtime symlink), tzset() reloads the
internal data and this reports false-positive alarms.
Other functions (like the localtime() interceptor)
already use InterceptorScope.
Sponsored by <The NetBSD Foundation>
Repository:
rL LLVM
https://reviews.llvm.org/D42050
Files:
lib/msan/msan_interceptors.cc
Index: lib/msan/msan_interceptors.cc
===================================================================
--- lib/msan/msan_interceptors.cc
+++ lib/msan/msan_interceptors.cc
@@ -38,6 +38,7 @@
#define fstat __fstat50
#define gettimeofday __gettimeofday50
#define getrusage __getrusage50
+#define tzset __tzset50
#endif
#include <stdarg.h>
@@ -1137,9 +1138,12 @@
extern char *tzname[2];
-INTERCEPTOR(void, tzset, int fake) {
+INTERCEPTOR(void, tzset, void) {
ENSURE_MSAN_INITED();
- REAL(tzset)(fake);
+ // Required for NetBSD, as there might be reloaded internal structs and we
+ // don't sanitize them.
+ InterceptorScope interceptor_scope;
+ REAL(tzset)();
if (tzname[0])
__msan_unpoison(tzname[0], REAL(strlen)(tzname[0]) + 1);
if (tzname[1])
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42050.129807.patch
Type: text/x-patch
Size: 775 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180115/69276dac/attachment.bin>
More information about the llvm-commits
mailing list