[PATCH] New "strict_string_checks" run-time flag

Maria Guseva m.guseva at samsung.com
Tue Mar 10 03:43:49 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) )
+
----------------
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.

================
Comment at: lib/sanitizer_common/sanitizer_flags.inc:149
@@ -148,1 +148,3 @@
             "If true, the shadow is not allowed to use huge pages. ")
+COMMON_FLAG(bool, strict_string_checks, true,
+            "If set check that string arguments are properly null-terminated")
----------------
kcc wrote:
> I afraid we should make it false at the first step. 
> Once this change is committed (and propagated into our internal base) we'll test with =true to see if it's sane. 
Ok, changed in new patch. Must be kept in mind that tests check default behaviour as well so they have to be modified when this value is changed.

http://reviews.llvm.org/D7123

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






More information about the llvm-commits mailing list