[PATCH] D55354: [Sanitizer] getmntinfo support in FreeBSD
David CARLIER via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 6 09:07:37 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL348500: [Sanitizer] getmntinfo support in FreeBSD (authored by devnexen, committed by ).
Herald added a subscriber: delcypher.
Changed prior to commit:
https://reviews.llvm.org/D55354?vs=176989&id=176992#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55354/new/
https://reviews.llvm.org/D55354
Files:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/getmntinfo.cc
compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/getmntinfo.cc
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
@@ -518,7 +518,7 @@
#define SANITIZER_INTERCEPT_NETENT SI_NETBSD
#define SANITIZER_INTERCEPT_SETVBUF (SI_NETBSD || SI_FREEBSD || \
SI_LINUX || SI_MAC)
-#define SANITIZER_INTERCEPT_GETMNTINFO SI_NETBSD
+#define SANITIZER_INTERCEPT_GETMNTINFO (SI_NETBSD || SI_FREEBSD)
#define SANITIZER_INTERCEPT_MI_VECTOR_HASH SI_NETBSD
#define SANITIZER_INTERCEPT_GETVFSSTAT SI_NETBSD
#define SANITIZER_INTERCEPT_REGEX SI_NETBSD
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -7278,7 +7278,11 @@
if (cnt > 0 && mntbufp) {
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, mntbufp, sizeof(void *));
if (*mntbufp)
+#if SANITIZER_NETBSD
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, *mntbufp, cnt * struct_statvfs_sz);
+#else
+ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, *mntbufp, cnt * struct_statfs_sz);
+#endif
}
return cnt;
}
Index: compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/getmntinfo.cc
===================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/getmntinfo.cc
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/getmntinfo.cc
@@ -0,0 +1,35 @@
+// RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
+//
+// UNSUPPORTED: linux, darwin, solaris
+
+#include <sys/types.h>
+
+#if defined(__NetBSD__)
+#include <sys/statvfs.h>
+#else
+#include <sys/mount.h>
+#endif
+
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(void) {
+ printf("getmntinfo\n");
+
+#if defined(__NetBSD__)
+ struct statvfs *fss;
+#else
+ struct statfs *fss;
+#endif
+ int nfss = getmntinfo(&fss, MNT_NOWAIT);
+ if (nfss <= 0)
+ errx(1, "getmntinfo");
+
+ for (int i = 0; i < nfss; i++)
+ printf("%d: %s\n", i, fss[i].f_fstypename);
+
+ // CHECK: getmntinfo
+
+ return 0;
+}
Index: compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/getmntinfo.cc
===================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/getmntinfo.cc
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/getmntinfo.cc
@@ -1,25 +0,0 @@
-// RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
-
-#include <sys/types.h>
-
-#include <sys/statvfs.h>
-
-#include <err.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-int main(void) {
- printf("getmntinfo\n");
-
- struct statvfs *fss;
- int nfss = getmntinfo(&fss, MNT_NOWAIT);
- if (nfss <= 0)
- errx(1, "getmntinfo");
-
- for (int i = 0; i < nfss; i++)
- printf("%d: %s\n", i, fss[i].f_fstypename);
-
- // CHECK: getmntinfo
-
- return 0;
-}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55354.176992.patch
Type: text/x-patch
Size: 3118 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181206/c3c0b941/attachment.bin>
More information about the llvm-commits
mailing list