Guard memory block allocation.
authorMartin Liska <mliska@suse.cz>
Mon, 24 Sep 2018 11:23:35 +0000 (13:23 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Mon, 24 Sep 2018 11:23:35 +0000 (11:23 +0000)
2018-09-24  Martin Liska  <mliska@suse.cz>

* memory-block.h (memory_block_pool::release): Annotate with
valgrind that the memory is not accessible.

From-SVN: r264529

gcc/ChangeLog
gcc/memory-block.h

index fc16b257d5af0f27b6bcd3dbc93a9d0072db0f6c..de6973aa3384ff84e01c97ebb6f5ebe404d3343f 100644 (file)
@@ -1,3 +1,8 @@
+2018-09-24  Martin Liska  <mliska@suse.cz>
+
+       * memory-block.h (memory_block_pool::release): Annotate with
+       valgrind that the memory is not accessible.
+
 2018-09-24  Martin Liska  <mliska@suse.cz>
 
        PR sanitizer/85774
index 5440428240d05a1fdc1e656b90efb537dea1a78f..c045d2e95ab2d789ace30d407f876bdfdb5457e0 100644 (file)
@@ -68,6 +68,11 @@ memory_block_pool::release (void *uncast_block)
   block_list *block = new (uncast_block) block_list;
   block->m_next = instance.m_blocks;
   instance.m_blocks = block;
+
+  VALGRIND_DISCARD (VALGRIND_MAKE_MEM_NOACCESS ((char *)uncast_block
+                                               + sizeof (block_list),
+                                               block_size
+                                               - sizeof (block_list)));
 }
 
 extern void *mempool_obstack_chunk_alloc (size_t) ATTRIBUTE_MALLOC;