[PATCH] D56670: [Sanitizer] Intercept sl_add api on FreeBSD/NetBSD
Kamil Rytarowski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 15 01:38:33 PST 2019
krytarowski added inline comments.
================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:9417
+#if SANITIZER_INTERCEPT_SL_FIND
+INTERCEPTOR(void *, sl_init) {
----------------
SANITIZER_INTERCEPT_SL_INIT
================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:9435
+ int res = REAL(sl_add)(sl, item);
+ if (res == 0)
+ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, sl, __sanitizer::struct_StringList_sz);
----------------
!res
================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:9461
+
+#define INIT_SLADD \
+ COMMON_INTERCEPT_FUNCTION(sl_init); \
----------------
INIT_SL_INIT
================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:9467
+#else
+#define INIT_SLADD
+#endif
----------------
INIT_SL_INIT
================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:9759
INIT_GETUSERSHELL;
+ INIT_SLADD;
----------------
INIT_SL_INIT
================
Comment at: lib/sanitizer_common/sanitizer_platform_interceptors.h:552
#define SANITIZER_INTERCEPT_GETUSERSHELL (SI_POSIX && !SI_POSIX)
+#define SANITIZER_INTERCEPT_SL_FIND (SI_FREEBSD || SI_NETBSD)
----------------
#define SANITIZER_INTERCEPT_SL_INIT (SI_FREEBSD || SI_NETBSD)
BTW, can we please move position of POPEN-FUNOPEN2 to the right place?
================
Comment at: test/sanitizer_common/TestCases/Posix/sl_add.cc:15
+ StringList *sl = sl_init();
+ assert(sl != nullptr);
+ char *p = strdup("entry");
----------------
assert(sl)
================
Comment at: test/sanitizer_common/TestCases/Posix/sl_add.cc:17
+ char *p = strdup("entry");
+ int ret = sl_add(sl, p);
+ assert(ret == 0);
----------------
assert(!sl_add(sl, p))
Repository:
rCRT Compiler Runtime
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56670/new/
https://reviews.llvm.org/D56670
More information about the llvm-commits
mailing list