[PATCH] D19411: [esan] EfficiencySanitizer libc interceptors

Mike Aizatsky via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 22 11:01:57 PDT 2016


aizatsky added inline comments.

================
Comment at: lib/esan/esan_interceptors.cpp:130
@@ +129,3 @@
+  uptr srclen = internal_strlen(src);
+  processRangeAccess(CUR_PC(), (uptr)dst, srclen + 1, true);
+  processRangeAccess(CUR_PC(), (uptr)src, srclen + 1, false);
----------------
Use COMMON_INTERCEPTOR_WRITE_RANGE & COMMON_INTERCEPTOR_READ_RANGE
throughout these methods. You have defined them anyway. It will make moving this code easier.

================
Comment at: lib/esan/esan_interceptors.cpp:137
@@ +136,3 @@
+  uptr srclen = internal_strnlen(src, n);
+  processRangeAccess(CUR_PC(), (uptr)dst, n, true);
+  processRangeAccess(CUR_PC(), (uptr)src, srclen + 1 > n ? n : srclen + 1,
----------------
Is this "n" correct or should it be the same expression as next line?

================
Comment at: lib/esan/esan_interceptors.cpp:143
@@ +142,3 @@
+
+#if SANITIZER_LINUX && !SANITIZER_ANDROID
+INTERCEPTOR(int, __xstat, int version, const char *path, void *buf) {
----------------
msan_interceptor does this differently:

(pseudocode)

#if FREEBSD

INTERCEPTOR(stat)

#else

INTERCEPTOR(__xstat)

#endif.

Is there a reason you always add 2 intercepts?


http://reviews.llvm.org/D19411





More information about the llvm-commits mailing list