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

Yury Gribov tetra2005 at gmail.com
Tue Mar 3 13:05:32 PST 2015


Comment at: lib/asan/asan_rtl.cc:314
@@ +313,3 @@
+  CacheBinaryName();
kcc wrote:
> do you really need to call this twice? 
Yes, just like AsanCheckIncompatibleRT is called twice in two types of initializers that we have (__asan_init and AsanInitializer). But - I should move it to AsanInitializer::AsanInitializer().

Comment at: lib/sanitizer_common/sanitizer_common.cc:357
@@ +356,3 @@
+void CacheBinaryName() {
+  BlockingMutexLock l(&binary_name_cache_lock);
+  if (!binary_name_cache_initialized) {
kcc wrote:
> So why do you still need the Mutex if you are calling this only once at init time? 
> Just add an asssertion that you've never initialized this before. 
> Then you also don't need binary_name_cache_initialized, you can use binary_name_cache_str[0], 
> which in turn could be function-scope because no one else needs it. 
I thought about that but I decided to keep CacheBinaryName more generic so that it could be used in other contexts besides pure program startup. I could remove this if you think it's unnecessary.

Comment at: lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc:647
@@ -646,7 +646,3 @@
   void PrepareForSandboxing() override {
-    BlockingMutexLock l(&mu_);
-    // Cache /proc/self/exe on Linux.
kcc wrote:
> So, do we still need this here? 
I don't know the whole sandboxing thing well enough so I kept it.

Comment at: test/asan/TestCases/verbose-log-path_test.cc:9
@@ +8,3 @@
+// FIXME: only FreeBSD and Linux have verbose log paths now.
+// XFAIL: win32
+// XFAIL: android
kcc wrote:
> maybe just put it inside test/asan/TestCases/Linux? 
Well, it's absolutely trivial to support on other platforms so I thought it makes sense to simply xfail.

Comment at: test/asan/TestCases/verbose-log-path_test.cc:16
@@ +15,3 @@
+int main(int argc, char **argv) {
+  if (argc > 2) return 0;
+  char *x = (char*)malloc(10);
kcc wrote:
> this test could be smaller, e.g. 
> int glob[10];
> int main(int argc, char **argv) {
>   return glob[argc * 10]; 
> }
That's a blind copy-paste of similar log_path test without log_exe_name.



More information about the llvm-commits mailing list