[PATCH] D46459: [asan] On RTEMS, checks for asan_inited before entering ASan run-time

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


waltl updated this revision to Diff 147439.
waltl added a comment.

Make GetCurrentThread RTEMS-friendly.


Repository:
  rL LLVM

https://reviews.llvm.org/D46459

Files:
  compiler-rt/lib/asan/asan_rtl.cc
  compiler-rt/lib/asan/asan_thread.cc


Index: compiler-rt/lib/asan/asan_thread.cc
===================================================================
--- compiler-rt/lib/asan/asan_thread.cc
+++ compiler-rt/lib/asan/asan_thread.cc
@@ -389,6 +389,9 @@
 }
 
 AsanThread *GetCurrentThread() {
+  if (SANITIZER_RTEMS && !asan_inited)
+    return nullptr;
+
   AsanThreadContext *context =
       reinterpret_cast<AsanThreadContext *>(AsanTSDGet());
   if (!context) {
Index: compiler-rt/lib/asan/asan_rtl.cc
===================================================================
--- compiler-rt/lib/asan/asan_rtl.cc
+++ compiler-rt/lib/asan/asan_rtl.cc
@@ -536,6 +536,9 @@
   if (curr_thread) {
     top = curr_thread->stack_top();
     bottom = ((uptr)&local_stack - PageSize) & ~(PageSize - 1);
+  } else if (SANITIZER_RTEMS) {
+    // Give up On RTEMS.
+    return;
   } else {
     CHECK(!SANITIZER_FUCHSIA);
     // If we haven't seen this thread, try asking the OS for stack bounds.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46459.147439.patch
Type: text/x-patch
Size: 942 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180518/a3debc4f/attachment.bin>


More information about the llvm-commits mailing list