Coverage for /Syzygy/agent/asan/nested_heap.cc

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
100.0%46460.C++source

Line-by-line coverage:

   1    :  // Copyright 2013 Google Inc. All Rights Reserved.
   2    :  //
   3    :  // Licensed under the Apache License, Version 2.0 (the "License");
   4    :  // you may not use this file except in compliance with the License.
   5    :  // You may obtain a copy of the License at
   6    :  //
   7    :  //     http://www.apache.org/licenses/LICENSE-2.0
   8    :  //
   9    :  // Unless required by applicable law or agreed to in writing, software
  10    :  // distributed under the License is distributed on an "AS IS" BASIS,
  11    :  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12    :  // See the License for the specific language governing permissions and
  13    :  // limitations under the License.
  14    :  #include "syzygy/agent/asan/nested_heap.h"
  15    :  
  16    :  #include "base/bits.h"
  17    :  #include "syzygy/agent/asan/asan_heap.h"
  18    :  #include "syzygy/agent/asan/asan_shadow.h"
  19    :  #include "syzygy/agent/asan/stack_capture.h"
  20    :  #include "syzygy/common/align.h"
  21    :  
  22    :  namespace {
  23    :  
  24    :  using agent::asan::HeapProxy;
  25    :  using agent::asan::Shadow;
  26    :  using agent::asan::StackCapture;
  27    :  
  28    :  }  // namespace
  29    :  
  30  E :  void asan_PoisonMemoryRange(const void* address, size_t size) {
  31  E :    DCHECK(address != NULL);
  32    :    DCHECK(common::IsAligned(reinterpret_cast<uint8>(address) + size,
  33  E :                             Shadow::kShadowGranularity));
  34    :  
  35  E :    Shadow::Poison(address, size, Shadow::kUserRedzone);
  36  E :  }
  37    :  
  38  E :  void asan_UnpoisonMemoryRange(const void* address, size_t size) {
  39  E :    DCHECK(address != NULL);
  40    :    DCHECK(common::IsAligned(reinterpret_cast<uint8>(address),
  41  E :                             Shadow::kShadowGranularity));
  42  E :    DCHECK(common::IsAligned(size, Shadow::kShadowGranularity));
  43    :  
  44  E :    Shadow::Unpoison(address, size);
  45  E :  }
  46    :  
  47    :  size_t asan_GetAsanObjectSize(size_t user_object_size,
  48  E :                                size_t alignment) {
  49  E :    return HeapProxy::GetAllocSize(user_object_size, alignment);
  50  E :  }
  51    :  
  52    :  void asan_GetUserExtent(const void* asan_pointer,
  53    :                          void** user_pointer,
  54  E :                          size_t* size) {
  55  E :    DCHECK(asan_pointer != NULL);
  56  E :    DCHECK(user_pointer != NULL);
  57  E :    DCHECK(size != NULL);
  58    :  
  59  E :    return HeapProxy::GetUserExtent(asan_pointer, user_pointer, size);
  60  E :  }
  61    :  
  62    :  void asan_GetAsanExtent(const void* user_pointer,
  63    :                          void** asan_pointer,
  64  E :                          size_t* size) {
  65  E :    DCHECK(user_pointer != NULL);
  66  E :    DCHECK(asan_pointer != NULL);
  67  E :    DCHECK(size != NULL);
  68    :  
  69  E :    HeapProxy::GetAsanExtent(user_pointer, asan_pointer, size);
  70  E :  }
  71    :  
  72    :  void asan_InitializeObject(void* asan_pointer,
  73    :                             size_t user_object_size,
  74  E :                             size_t alignment) {
  75  E :    DCHECK(asan_pointer != NULL);
  76    :  
  77  E :    uint8 alignment_log = base::bits::Log2Floor(alignment);
  78    :  
  79  E :    StackCapture stack;
  80  E :    stack.InitFromStack();
  81    :  
  82    :    HeapProxy::InitializeAsanBlock(reinterpret_cast<uint8*>(asan_pointer),
  83    :                                   user_object_size,
  84    :                                   HeapProxy::GetAllocSize(user_object_size,
  85    :                                                           alignment),
  86    :                                   alignment_log,
  87  E :                                   stack);
  88  E :  }
  89    :  
  90  E :  void asan_QuarantineObject(void* asan_pointer) {
  91  E :    DCHECK(asan_pointer != NULL);
  92    :  
  93  E :    StackCapture stack;
  94  E :    stack.InitFromStack();
  95    :  
  96  E :    HeapProxy::MarkBlockAsQuarantined(asan_pointer, stack);
  97  E :  }
  98    :  
  99  E :  void asan_DestroyObject(void* asan_pointer) {
 100  E :    DCHECK(asan_pointer != NULL);
 101    :  
 102  E :    HeapProxy::DestroyAsanBlock(asan_pointer);
 103  E :  }
 104    :  
 105    :  void asan_CloneObject(const void* src_asan_pointer,
 106  E :                        void* dst_asan_pointer) {
 107  E :    HeapProxy::CloneObject(src_asan_pointer, dst_asan_pointer);
 108  E :  }

Coverage information generated Wed Dec 11 11:34:16 2013.