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

Kostya Serebryany kcc at google.com
Mon Mar 16 13:26:07 PDT 2015


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:
> > 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. 
> Could you be more specific? I can see that ASan and UBSan have been changed to have isolated copies of some core structures (e.g. suppressions). But error reporting (e.g. report_file or log_path) are still shared across all sanitizers with mutexes being used to serialize accesses.
Alexey actually tells that this part will be ready later this week. 
The idea is that something like __ubsan_common_init() will be called from __asan_init() if ubsan and asan are bundled and 
from __ubsan_init() if ubsan runs separately. 
In this case, we can call CacheBinaryName in __ubsan_init and in __asan_init. 
This way it will be ensured that CacheBinaryName is executed strictly once, and we'll be able to add the CHECK to prevent from calling it for the second time. 
Can you wait a few more days before Alexey lands his patch?



More information about the llvm-commits mailing list