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

Walter Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 17 21:47:09 PDT 2018


waltl marked 2 inline comments as done.
waltl added inline comments.


================
Comment at: compiler-rt/lib/asan/asan_fake_stack.cc:197
+    return nullptr;
   if (FakeStack *fs = GetTLSFakeStack())
     return fs;
----------------
waltl wrote:
> vitalybuka wrote:
> > GetTLSFakeStack probably will return 0 anyway?
> GetTLSFakeStack is currently not enabled for RTEMS.  But regardless, the problem is that thread locals don't work for instrumented code during booting, before ASan compiler-rt has been initialized.  Both this entry point and the one in __asan_handle_no_return eventually access TLS (either through GetTLSFakeStack or GetCurrentThread) which would crash the program.
> 
> Maybe I should put the check in GetCurrentThread so that it returns NULL instead of crash when !asan_inited?  I can put together a patch based on that.
I uploaded the proposed patch.  Please let me know what you think.



Repository:
  rL LLVM

https://reviews.llvm.org/D46459





More information about the llvm-commits mailing list