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

Yury Gribov tetra2005 at gmail.com
Thu Mar 12 00:28:58 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;
+
----------------
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.

================
Comment at: lib/sanitizer_common/sanitizer_common.cc:360
@@ +359,3 @@
+  static bool binary_name_initialized;
+  if (LIKELY(binary_name_initialized))
+    return;
----------------
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.

================
Comment at: lib/sanitizer_common/sanitizer_common.cc:364
@@ +363,3 @@
+  binary_basename_cache_str = StripModuleName(binary_name_cache_str);
+  binary_name_initialized = true;
+}
----------------
kcc wrote:
> You can probably implement this thing w/o an extra static bool, just use binary_basename_cache_str 
Right.

http://reviews.llvm.org/D7333

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






More information about the llvm-commits mailing list