Skip to content

Commit

Permalink
i#2571 exit flags not reset: reset on init.
Browse files Browse the repository at this point in the history
Tested: ctest,internal repro.

Fixes DynamoRIO#2571
  • Loading branch information
s-kanev committed Jul 28, 2017
1 parent cd0eaca commit 34dfb78
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions core/heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ typedef struct _heap_t {
uint num_dead;
} heap_t;

/* no synch needed since only written once */
/* protected by dynamo_vm_areas_lock() */
static bool heap_exiting = false;

#ifdef DEBUG
Expand Down Expand Up @@ -1401,6 +1401,9 @@ vmm_heap_init()
if (DYNAMO_OPTION(vm_reserve)) {
vmm_heap_unit_init(&heapmgt->vmheap, DYNAMO_OPTION(vm_size));
}
dynamo_vm_areas_lock();
heap_exiting = false;
dynamo_vm_areas_unlock();
}

void
Expand Down Expand Up @@ -1547,8 +1550,6 @@ heap_init()
* FIXME: ensure that release build aligns ok?
* I would be quite surprised if static vars were not 4-byte-aligned!
*/
ASSERT(ALIGN_BACKWARD(&heap_exiting, CACHE_LINE_SIZE()) ==
ALIGN_BACKWARD(&heap_exiting + 1, CACHE_LINE_SIZE()));
ASSERT(ALIGN_BACKWARD(&heap_unit_lock.owner, CACHE_LINE_SIZE()) ==
ALIGN_BACKWARD(&heap_unit_lock.owner + 1, CACHE_LINE_SIZE()));

Expand Down Expand Up @@ -1645,9 +1646,9 @@ heap_exit()
heap_unit_t *u, *next_u;
heap_management_t *temp;

heap_exiting = true;
/* FIXME: we shouldn't need either lock if executed last */
dynamo_vm_areas_lock();
heap_exiting = true;
acquire_recursive_lock(&heap_unit_lock);

#ifdef WINDOWS
Expand Down
1 change: 1 addition & 0 deletions core/vmareas.c
Original file line number Diff line number Diff line change
Expand Up @@ -1566,6 +1566,7 @@ vm_areas_reset_init(void)
void
dynamo_vm_areas_init()
{
vm_areas_exited = false;
VMVECTOR_ALLOC_VECTOR(dynamo_areas, GLOBAL_DCONTEXT, VECTOR_SHARED,
dynamo_areas);
}
Expand Down

0 comments on commit 34dfb78

Please sign in to comment.