[PATCH] [ASan] Add process basename to log name and error message to simplify analysis of sanitized systems logs.

Kostya Serebryany kcc at google.com
Thu Mar 12 13:15:20 PDT 2015


REPOSITORY
  rL LLVM

================
Comment at: lib/sanitizer_common/sanitizer_common.cc:347
@@ +346,3 @@
+static char binary_name_cache_str[kMaxPathLength];
+static const char *binary_basename_cache_str = binary_name_cache_str;
+
----------------
ygribov wrote:
> kcc wrote:
> > initialize to nullptr, so that if we forget to call CacheBinaryName we instantly crash 
> Yeah, I thought about this. But note that even though we call CacheBinaryName very early, some code has to execute before it. And I'd prefer this code to print something at least to stderr instead of crashing.
Sure, use CHECK_NE(foo, nullptr)

================
Comment at: lib/sanitizer_common/sanitizer_common.cc:360
@@ +359,3 @@
+  static bool binary_name_initialized;
+  if (LIKELY(binary_name_initialized))
+    return;
----------------
ygribov wrote:
> kcc wrote:
> > This will not catch a situation where someone calls CacheBinaryName() twice, which should be illegal. 
> > Instead, do a hard check that this is the first call. 
> Unfortunately we do have situations where double call is needed e.g. when app is both A- and UB-sanitized.
I believe the recent refactoring by Alexey allows to solve this. 
Really, if we allow double call but do not allow lazy initialization later on we are asking for trouble.

http://reviews.llvm.org/D7333

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






More information about the llvm-commits mailing list