[PATCH] New "strict_string_checks" run-time flag

Maria Guseva m.guseva at samsung.com
Tue Mar 10 06:19:27 PDT 2015


================
Comment at: lib/asan/asan_interceptors.cc:80
@@ +79,3 @@
+  ASAN_READ_RANGE((ctx), (s),                                   \
+    common_flags()->strict_string_checks ? internal_strlen(s) + 1 : (n) )
+
----------------
m.guseva wrote:
> kcc wrote:
> > Interesting.
> > This code is going to be hot, and internal_strlen(s) is not optimized for speed (and is not expected to be). 
> > Near some of the places where we now call ASAN_READ_RANGE there are calls to REAL(strlen)(to), so you essentially repeat the call (but using slow internal_strlen). 
> > Try not to repeat the strlen calls and try to rely on REAL(strlen), which is ~16x faster. 
> Ok, in new patch I've introduced more general macro ASAN_READ_STRING_OF_LEN in order to not repeat strlen calls. The same done for tsan, msan and common interceptors.
I've changed internal_strlen to REAL(strlen) only in asan/common part but probably I should fix tsan and msan as well. But I see that in other tsan interceptors internal_strlen is used. Is it intentional there?

http://reviews.llvm.org/D7123

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list