[compiler-rt] 9b9c68a - hwasan: Remove dead code. NFCI.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 15:12:56 PST 2020


Author: Peter Collingbourne
Date: 2020-01-17T15:12:38-08:00
New Revision: 9b9c68a2d6adea397e6bc22b29d6d81bb997a256

URL: https://github.com/llvm/llvm-project/commit/9b9c68a2d6adea397e6bc22b29d6d81bb997a256
DIFF: https://github.com/llvm/llvm-project/commit/9b9c68a2d6adea397e6bc22b29d6d81bb997a256.diff

LOG: hwasan: Remove dead code. NFCI.

Differential Revision: https://reviews.llvm.org/D72896

Added: 
    

Modified: 
    compiler-rt/lib/hwasan/hwasan.cpp
    compiler-rt/lib/hwasan/hwasan.h
    compiler-rt/lib/hwasan/hwasan_thread.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/hwasan/hwasan.cpp b/compiler-rt/lib/hwasan/hwasan.cpp
index 7b5c6c694be9..f8c9446b68b1 100644
--- a/compiler-rt/lib/hwasan/hwasan.cpp
+++ b/compiler-rt/lib/hwasan/hwasan.cpp
@@ -36,21 +36,6 @@ using namespace __sanitizer;
 
 namespace __hwasan {
 
-void EnterSymbolizer() {
-  Thread *t = GetCurrentThread();
-  CHECK(t);
-  t->EnterSymbolizer();
-}
-void ExitSymbolizer() {
-  Thread *t = GetCurrentThread();
-  CHECK(t);
-  t->LeaveSymbolizer();
-}
-bool IsInSymbolizer() {
-  Thread *t = GetCurrentThread();
-  return t && t->InSymbolizer();
-}
-
 static Flags hwasan_flags;
 
 Flags *flags() {
@@ -205,15 +190,8 @@ void __sanitizer::BufferedStackTrace::UnwindImpl(
     size = 0;
     return;
   }
-  if (!StackTrace::WillUseFastUnwind(request_fast)) {
-    // Block reports from our interceptors during _Unwind_Backtrace.
-    SymbolizerScope sym_scope;
-    return Unwind(max_depth, pc, bp, context, 0, 0, request_fast);
-  }
-  if (StackTrace::WillUseFastUnwind(request_fast))
-    Unwind(max_depth, pc, bp, nullptr, t->stack_top(), t->stack_bottom(), true);
-  else
-    Unwind(max_depth, pc, 0, context, 0, 0, false);
+  Unwind(max_depth, pc, bp, context, t->stack_top(), t->stack_bottom(),
+         request_fast);
 }
 
 struct hwasan_global {
@@ -387,8 +365,6 @@ void __hwasan_init() {
   InstallDeadlySignalHandlers(HwasanOnDeadlySignal);
   InstallAtExitHandler(); // Needs __cxa_atexit interceptor.
 
-  Symbolizer::GetOrInit()->AddHooks(EnterSymbolizer, ExitSymbolizer);
-
   InitializeCoverage(common_flags()->coverage, common_flags()->coverage_dir);
 
   HwasanTSDInit();

diff  --git a/compiler-rt/lib/hwasan/hwasan.h b/compiler-rt/lib/hwasan/hwasan.h
index 64cdcf30f5c7..8cbd9e74e335 100644
--- a/compiler-rt/lib/hwasan/hwasan.h
+++ b/compiler-rt/lib/hwasan/hwasan.h
@@ -72,16 +72,13 @@ extern int hwasan_inited;
 extern bool hwasan_init_is_running;
 extern int hwasan_report_count;
 
-bool ProtectRange(uptr beg, uptr end);
 bool InitShadow();
 void InitPrctl();
 void InitThreads();
 void MadviseShadow();
-char *GetProcSelfMaps();
 void InitializeInterceptors();
 
 void HwasanAllocatorInit();
-void HwasanAllocatorThreadFinish();
 
 void *hwasan_malloc(uptr size, StackTrace *stack);
 void *hwasan_calloc(uptr nmemb, uptr size, StackTrace *stack);
@@ -95,24 +92,8 @@ int hwasan_posix_memalign(void **memptr, uptr alignment, uptr size,
                         StackTrace *stack);
 void hwasan_free(void *ptr, StackTrace *stack);
 
-void InstallTrapHandler();
 void InstallAtExitHandler();
 
-void EnterSymbolizer();
-void ExitSymbolizer();
-bool IsInSymbolizer();
-
-struct SymbolizerScope {
-  SymbolizerScope() { EnterSymbolizer(); }
-  ~SymbolizerScope() { ExitSymbolizer(); }
-};
-
-// Returns a "chained" origin id, pointing to the given stack trace followed by
-// the previous origin id.
-u32 ChainOrigin(u32 id, StackTrace *stack);
-
-const int STACK_TRACE_TAG_POISON = StackTrace::TAG_CUSTOM + 1;
-
 #define GET_MALLOC_STACK_TRACE                                            \
   BufferedStackTrace stack;                                               \
   if (hwasan_inited)                                                      \
@@ -134,16 +115,6 @@ const int STACK_TRACE_TAG_POISON = StackTrace::TAG_CUSTOM + 1;
     stack.Print();                  \
   }
 
-class ScopedThreadLocalStateBackup {
- public:
-  ScopedThreadLocalStateBackup() { Backup(); }
-  ~ScopedThreadLocalStateBackup() { Restore(); }
-  void Backup();
-  void Restore();
- private:
-  u64 va_arg_overflow_size_tls;
-};
-
 void HwasanTSDInit();
 void HwasanTSDThreadInit();
 

diff  --git a/compiler-rt/lib/hwasan/hwasan_thread.h b/compiler-rt/lib/hwasan/hwasan_thread.h
index 42c1e9e124b0..ebcdb791fb36 100644
--- a/compiler-rt/lib/hwasan/hwasan_thread.h
+++ b/compiler-rt/lib/hwasan/hwasan_thread.h
@@ -38,14 +38,6 @@ class Thread {
     return addr >= stack_bottom_ && addr < stack_top_;
   }
 
-  bool InSignalHandler() { return in_signal_handler_; }
-  void EnterSignalHandler() { in_signal_handler_++; }
-  void LeaveSignalHandler() { in_signal_handler_--; }
-
-  bool InSymbolizer() { return in_symbolizer_; }
-  void EnterSymbolizer() { in_symbolizer_++; }
-  void LeaveSymbolizer() { in_symbolizer_--; }
-
   AllocatorCache *allocator_cache() { return &allocator_cache_; }
   HeapAllocationsRingBuffer *heap_allocations() { return heap_allocations_; }
   StackAllocationsRingBuffer *stack_allocations() { return stack_allocations_; }
@@ -54,7 +46,6 @@ class Thread {
 
   void DisableTagging() { tagging_disabled_++; }
   void EnableTagging() { tagging_disabled_--; }
-  bool TaggingIsDisabled() const { return tagging_disabled_; }
 
   u64 unique_id() const { return unique_id_; }
   void Announce() {
@@ -76,9 +67,6 @@ class Thread {
   uptr tls_begin_;
   uptr tls_end_;
 
-  unsigned in_signal_handler_;
-  unsigned in_symbolizer_;
-
   u32 random_state_;
   u32 random_buffer_;
 
@@ -86,8 +74,6 @@ class Thread {
   HeapAllocationsRingBuffer *heap_allocations_;
   StackAllocationsRingBuffer *stack_allocations_;
 
-  static void InsertIntoThreadList(Thread *t);
-  static void RemoveFromThreadList(Thread *t);
   Thread *next_;  // All live threads form a linked list.
 
   u64 unique_id_;  // counting from zero.


        


More information about the llvm-commits mailing list