mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-08-04 09:30:00 +03:00
Fix a Valgrind integration flaw.
Fix a Valgrind integration flaw that caused Valgrind warnings about reads of uninitialized memory in arena chunk headers.
This commit is contained in:
parent
543abf7e6c
commit
87a02d2bb1
3 changed files with 57 additions and 32 deletions
21
src/arena.c
21
src/arena.c
|
|
@ -569,17 +569,24 @@ arena_chunk_alloc(arena_t *arena)
|
|||
* unless the chunk is not zeroed.
|
||||
*/
|
||||
if (zero == false) {
|
||||
VALGRIND_MAKE_MEM_UNDEFINED(
|
||||
(void *)arena_mapp_get(chunk, map_bias+1),
|
||||
(size_t)((uintptr_t) arena_mapp_get(chunk,
|
||||
chunk_npages-1) - (uintptr_t)arena_mapp_get(chunk,
|
||||
map_bias+1)));
|
||||
for (i = map_bias+1; i < chunk_npages-1; i++)
|
||||
arena_mapbits_unzeroed_set(chunk, i, unzeroed);
|
||||
} else if (config_debug) {
|
||||
} else {
|
||||
VALGRIND_MAKE_MEM_DEFINED(
|
||||
(void *)arena_mapp_get(chunk, map_bias+1),
|
||||
(void *)((uintptr_t)
|
||||
arena_mapp_get(chunk, chunk_npages-1)
|
||||
- (uintptr_t)arena_mapp_get(chunk, map_bias+1)));
|
||||
for (i = map_bias+1; i < chunk_npages-1; i++) {
|
||||
assert(arena_mapbits_unzeroed_get(chunk, i) ==
|
||||
unzeroed);
|
||||
(size_t)((uintptr_t) arena_mapp_get(chunk,
|
||||
chunk_npages-1) - (uintptr_t)arena_mapp_get(chunk,
|
||||
map_bias+1)));
|
||||
if (config_debug) {
|
||||
for (i = map_bias+1; i < chunk_npages-1; i++) {
|
||||
assert(arena_mapbits_unzeroed_get(chunk,
|
||||
i) == unzeroed);
|
||||
}
|
||||
}
|
||||
}
|
||||
arena_mapbits_unallocated_set(chunk, chunk_npages-1,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue