Prevent recursive MSan interceptors in fgets(3)
authorKamil Rytarowski <n54@gmx.com>
Thu, 15 Feb 2018 02:47:35 +0000 (02:47 +0000)
committerKamil Rytarowski <n54@gmx.com>
Thu, 15 Feb 2018 02:47:35 +0000 (02:47 +0000)
Summary:
This corrects intercepting this call on NetBSD without false positives.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, eugenis, vitalybuka

Reviewed By: vitalybuka

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D42884

llvm-svn: 325207

compiler-rt/lib/msan/msan_interceptors.cc

index b83875d..c99fb95 100644 (file)
@@ -779,6 +779,7 @@ INTERCEPTOR(int, socketpair, int domain, int type, int protocol, int sv[2]) {
 
 INTERCEPTOR(char *, fgets, char *s, int size, void *stream) {
   ENSURE_MSAN_INITED();
+  InterceptorScope interceptor_scope;
   char *res = REAL(fgets)(s, size, stream);
   if (res)
     __msan_unpoison(s, REAL(strlen)(s) + 1);