[PATCH] D46459: [asan] Make GetCurrentThread RTEMS-friendly

Walter Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 18 11:20:54 PDT 2018


waltl marked an inline comment as done.
waltl added inline comments.


================
Comment at: compiler-rt/lib/asan/asan_thread.cc:394
+    return nullptr;
+
   AsanThreadContext *context =
----------------
alekseyshl wrote:
> vitalybuka wrote:
> > alekseyshl wrote:
> > > vitalybuka wrote:
> > > > What if you just put here and we avoid platform specific branch
> > > > ```
> > > > if (UNLIKELY(!asan_inited))
> > > >   AsanInitFromRtl();
> > > > ```
> > > > 
> > > > !asan_inited is not expected here on any other platform
> > > But it still be a check, still some code executed, even if it is unlikely. With SANITIZER_RTEMS, it will be removed on all platforms, but RTEMS.
> > > 
> > > The semantics is also wrong, this way it creates an impression that it can happen on all platforms.
> > With first part I agree, we don't want additional check here as this can be called quite frequently.  So it makes sense to move AsanInitFromRtl() into __asan_handle_no_return
> > 
> > For semantics, I'd rather have as much as possible same function on all platform, even if it handles cases which are not necessary on some of them.
> From the patch comment it can be called "after ASan run-time has been destroyed". Why would we want to call AsanInitFromRtl again?
Unfortunately it's not safe to call AsanInitFromRtl() under these conditions.  It could be before pthreads have been initialized.



Repository:
  rL LLVM

https://reviews.llvm.org/D46459





More information about the llvm-commits mailing list