[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 Feb 19 17:00:39 PST 2015


sorry for delay...


REPOSITORY
  rL LLVM

================
Comment at: lib/sanitizer_common/sanitizer_common.cc:58
@@ -57,2 +57,3 @@
 
-  internal_snprintf(full_path, kMaxPathLength, "%s.%zu", path_prefix, pid);
+  const char *pname = StripModuleName(GetBinaryName());
+  internal_snprintf(full_path, kMaxPathLength, "%s.%s.%zu", path_prefix, pname,
----------------
What's "pname"? Can this be more descriptive? 
Also, if this does not change over time, we should just precompute it at start up

================
Comment at: lib/sanitizer_common/sanitizer_common.cc:299
@@ +298,3 @@
+
+const char *GetBinaryName() {
+  BlockingMutexLock l(&binary_name_cache_lock);
----------------
does binary name change over time? 
If not, we should compute it at start up w/o any mutexes

================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:709
@@ -718,2 +708,3 @@
 #if SANITIZER_FREEBSD
-  const int Mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
+  const int Mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
+  const char *default_module_name = "kern.proc.pathname";
----------------
I am lost here. What's being changed? 

================
Comment at: lib/sanitizer_common/sanitizer_printf.cc:257
@@ +256,3 @@
+      const char *pname = StripModuleName(GetBinaryName());
+      needed_length += internal_snprintf(buffer, buffer_size,
+                                         "==%s %d==", pname, pid);
----------------
So, now everyone will have the module name in their logs by default? 
Not good. Make it an option. 

================
Comment at: test/asan/lit.cfg:135
@@ -134,1 +134,3 @@
 
+# Allow tests to use REQUIRES=verbose-log-path.
+if config.host_os in ['FreeBSD', 'Linux']:
----------------
I think this is an overkill. Just make the tests require linux/Freebsd

http://reviews.llvm.org/D7333

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






More information about the llvm-commits mailing list