Coverage for /Syzygy/agent/asan/page_protection_helpers.h

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
0.0%0015.C++source

Line-by-line coverage:

   1    :  // Copyright 2014 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    :  //
  15    :  // Collection of functions and objects for modifying page protections in a
  16    :  // consistent way.
  17    :  
  18    :  #ifndef SYZYGY_AGENT_ASAN_PAGE_PROTECTION_HELPERS_H_
  19    :  #define SYZYGY_AGENT_ASAN_PAGE_PROTECTION_HELPERS_H_
  20    :  
  21    :  #include "syzygy/agent/asan/block.h"
  22    :  #include "syzygy/agent/asan/shadow.h"
  23    :  #include "syzygy/common/recursive_lock.h"
  24    :  
  25  m :  namespace agent {
  26  m :  namespace asan {
  27    :  
  28    :  // A global recursive lock. This gates all access to block protection
  29    :  // functions. This is exposed for crash processing, which wants to block
  30    :  // other threads from tinkering with page protections.
  31  m :  extern ::common::RecursiveLock block_protect_lock;
  32    :  
  33    :  // Given a pointer to the body of a block extracts its layout. If the block
  34    :  // header is not under any block protections then the layout will be read from
  35    :  // the header. If the header is corrupt, or the memory is otherwise unreadable,
  36    :  // this will be inferred from the shadow memory (less efficient, but not subject
  37    :  // to corruption). This is effectively a wrapper to BlockInfoFromMemory and
  38    :  // Shadow::GetBlockInfo.
  39    :  // @param shadow The shadow to query.
  40    :  // @param body A pointer to the body of a block.
  41    :  // @param block_info The description of the block to be populated.
  42    :  // @returns true if a valid block was encountered at the provided location,
  43    :  //     false otherwise.
  44  m :  bool GetBlockInfo(const Shadow* shadow,
  45  m :                    const BlockBody* body,
  46  m :                    CompactBlockInfo* block_info);
  47  m :  bool GetBlockInfo(const Shadow* shadow,
  48  m :                    const BlockBody* body,
  49  m :                    BlockInfo* block_info);
  50    :  
  51    :  // Unprotects all pages fully covered by the given block. All pages
  52    :  // intersecting but not fully covered by the block will be left in their
  53    :  // current state.
  54    :  // @param block_info The block whose protections are to be modified.
  55    :  // @param shadow The shadow to update.
  56    :  // @note Under block_protect_lock.
  57  m :  void BlockProtectNone(const BlockInfo& block_info, Shadow* shadow);
  58    :  
  59    :  // Protects all entire pages that are spanned by the redzones of the
  60    :  // block. All pages intersecting the body of the block will be explicitly
  61    :  // unprotected. All pages not intersecting the body but only partially
  62    :  // covered by the redzone will be left in their current state.
  63    :  // @param block_info The block whose protections are to be modified.
  64    :  // @param shadow The shadow to update.
  65    :  // @note Under block_protect_lock.
  66  m :  void BlockProtectRedzones(const BlockInfo& block_info, Shadow* shadow);
  67    :  
  68    :  // Protects all pages completely spanned by the block. All pages
  69    :  // intersecting but not fully covered by the block will be left in their
  70    :  // current state.
  71    :  // @param block_info The block whose protections are to be modified.
  72    :  // @param shadow The shadow to update.
  73    :  // @note Under block_protect_lock.
  74  m :  void BlockProtectAll(const BlockInfo& block_info, Shadow* shadow);
  75    :  
  76    :  // Sets the block protections according to the block state. If in the allocated
  77    :  // state uses BlockProtectRedzones. If in quarantined or freed uses
  78    :  // BlockProtectAll.
  79    :  // @param block_info The block whose protections are to be modified.
  80    :  // @param shadow The shadow to update.
  81    :  // @note Under block_protect_lock.
  82  m :  void BlockProtectAuto(const BlockInfo& block_info, Shadow* shadow);
  83    :  
  84  m :  }  // namespace asan
  85  m :  }  // namespace agent
  86    :  
  87    :  #endif  // SYZYGY_AGENT_ASAN_PAGE_PROTECTION_HELPERS_H_

Coverage information generated Thu Jan 14 17:40:38 2016.