[PATCH] D19411: [esan] EfficiencySanitizer libc interceptors

Derek Bruening via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 22 13:15:18 PDT 2016


bruening marked 3 inline comments as done.

================
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,
----------------
aizatsky wrote:
> Is this "n" correct or should it be the same expression as next line?
Both asan and tsan consider it to write the full passed-in size but read the min value, as I had it here (modeled after tsan).  The full passed-in size should be addressable, but it should not be marked as written, so they both seem incorrect.  It should be the next line, for purposes of what's actually written.  I will send a separate CL to change tsan and asan (unless you know of reasons why they want the capacity and not the actual written value: for syscalls, DrMemory treats the capacity and written amount differently, but I'm not sure whether these sanitizers do something like that on libc calls and I don't see code for such separate handling at first glance).

================
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) {
----------------
aizatsky wrote:
> msan_interceptor does this differently:
> 
> (pseudocode)
> 
> #if FREEBSD
> 
> INTERCEPTOR(stat)
> 
> #else
> 
> INTERCEPTOR(__xstat)
> 
> #endif.
> 
> Is there a reason you always add 2 intercepts?
This is precisely what tsan does.  It looks incorrect.  I will fix here and and have a separate CL for fixing tsan.  It sounds like tsan wasn't the best one to use as a model, or that perhaps these should have been moved to the common pool first where the process would have compared to other sanitizers.  There are several confusing differences between the tsan and msan interceptors though which will take effort to sort out: later.


http://reviews.llvm.org/D19411





More information about the llvm-commits mailing list