From d609225669c3475adc236cd66968f99a3ca5aab5 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 24 Sep 2018 13:23:35 +0200 Subject: [PATCH] Guard memory block allocation. 2018-09-24 Martin Liska * memory-block.h (memory_block_pool::release): Annotate with valgrind that the memory is not accessible. From-SVN: r264529 --- gcc/ChangeLog | 5 +++++ gcc/memory-block.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fc16b257d5a..de6973aa338 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-09-24 Martin Liska + + * memory-block.h (memory_block_pool::release): Annotate with + valgrind that the memory is not accessible. + 2018-09-24 Martin Liska PR sanitizer/85774 diff --git a/gcc/memory-block.h b/gcc/memory-block.h index 5440428240d..c045d2e95ab 100644 --- a/gcc/memory-block.h +++ b/gcc/memory-block.h @@ -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; -- 2.30.2