[PATCH] D56138: [Sanitizer] Enable getfsent api for Darwin/Linux
David CARLIER via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 28 13:10:26 PST 2018
devnexen updated this revision to Diff 179658.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56138/new/
https://reviews.llvm.org/D56138
Files:
lib/sanitizer_common/sanitizer_common_interceptors.inc
lib/sanitizer_common/sanitizer_platform_interceptors.h
lib/sanitizer_common/sanitizer_platform_limits_posix.cc
lib/sanitizer_common/sanitizer_platform_limits_posix.h
test/sanitizer_common/TestCases/Posix/getfsent.cc
Index: test/sanitizer_common/TestCases/Posix/getfsent.cc
===================================================================
--- test/sanitizer_common/TestCases/Posix/getfsent.cc
+++ test/sanitizer_common/TestCases/Posix/getfsent.cc
@@ -1,6 +1,6 @@
// RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
//
-// UNSUPPORTED: linux, darwin, solaris
+// UNSUPPORTED: solaris
#include <assert.h>
#include <errno.h>
Index: lib/sanitizer_common/sanitizer_platform_limits_posix.h
===================================================================
--- lib/sanitizer_common/sanitizer_platform_limits_posix.h
+++ lib/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -51,6 +51,7 @@
extern unsigned struct_statfs64_sz;
extern unsigned struct_regex_sz;
extern unsigned struct_regmatch_sz;
+ extern unsigned struct_fstab_sz;
#if !SANITIZER_ANDROID
extern unsigned struct_statfs_sz;
Index: lib/sanitizer_common/sanitizer_platform_limits_posix.cc
===================================================================
--- lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ lib/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -25,6 +25,7 @@
#endif
#include <arpa/inet.h>
#include <dirent.h>
+#include <fstab.h>
#include <grp.h>
#include <limits.h>
#include <net/if.h>
@@ -192,6 +193,7 @@
unsigned struct_sched_param_sz = sizeof(struct sched_param);
unsigned struct_regex_sz = sizeof(regex_t);
unsigned struct_regmatch_sz = sizeof(regmatch_t);
+ unsigned struct_fstab_sz = sizeof(struct fstab);
#if SANITIZER_MAC && !SANITIZER_IOS
Index: lib/sanitizer_common/sanitizer_platform_interceptors.h
===================================================================
--- lib/sanitizer_common/sanitizer_platform_interceptors.h
+++ lib/sanitizer_common/sanitizer_platform_interceptors.h
@@ -545,7 +545,7 @@
#define SANITIZER_INTERCEPT_SHA2 SI_NETBSD
#define SANITIZER_INTERCEPT_CDB SI_NETBSD
#define SANITIZER_INTERCEPT_VIS (SI_NETBSD || SI_FREEBSD)
-#define SANITIZER_INTERCEPT_GETFSENT (SI_FREEBSD || SI_NETBSD)
+#define SANITIZER_INTERCEPT_GETFSENT (SI_FREEBSD || SI_NETBSD || SI_LINUX || SI_MAC)
#define SANITIZER_INTERCEPT_ARC4RANDOM (SI_FREEBSD || SI_NETBSD)
#endif // #ifndef SANITIZER_PLATFORM_INTERCEPTORS_H
Index: lib/sanitizer_common/sanitizer_common_interceptors.inc
===================================================================
--- lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -9058,7 +9058,7 @@
INTERCEPTOR(void *, getfsspec, const char *spec) {
void *ctx;
COMMON_INTERCEPTOR_ENTER(ctx, getfsspec, spec);
- if (spec)
+ if (common_flags()->strict_string_checks && spec)
COMMON_INTERCEPTOR_READ_RANGE(ctx, spec, REAL(strlen)(spec) + 1);
void *ret = REAL(getfsspec)(spec);
if (ret)
@@ -9069,7 +9069,7 @@
INTERCEPTOR(void *, getfsfile, const char *file) {
void *ctx;
COMMON_INTERCEPTOR_ENTER(ctx, getfsfile, file);
- if (file)
+ if (common_flags()->strict_string_checks && file)
COMMON_INTERCEPTOR_READ_RANGE(ctx, file, REAL(strlen)(file) + 1);
void *ret = REAL(getfsfile)(file);
if (ret)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56138.179658.patch
Type: text/x-patch
Size: 3170 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181228/b65f8ac1/attachment.bin>
More information about the llvm-commits
mailing list