Skip to content

Commit

Permalink
i#3049: clean postcall_cache when drwrap_exit (#3064)
Browse files Browse the repository at this point in the history
This commit is the supplement for PR #3050.
We also need to clean postcall_cache on drwrap_exit, otherwise
post_callback will not be invoked at re-attach. This is because the registration
of post_callback relies on pre_callback, and the pre_callback checks postcall_cache
before registering the post_callback. The stale data in postcall_cache prevents
post_callback being registered to the hash table.

Issue: #3065, #2157 
Fixes #3049
  • Loading branch information
Louis-Ye authored and derekbruening committed Jun 22, 2018
1 parent 65c64f2 commit 2fd4fdd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ext/drwrap/drwrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,11 @@ drwrap_exit(void)
!dr_unregister_delete_event(drwrap_fragment_delete))
ASSERT(false, "failed to unregister in drwrap_exit");

for (int i = 0; i < POSTCALL_CACHE_SIZE; i++) {
postcall_cache[i] = NULL;
}
postcall_cache_idx = 0;

hashtable_delete(&replace_table);
hashtable_delete(&replace_native_table);
hashtable_delete(&wrap_table);
Expand Down

0 comments on commit 2fd4fdd

Please sign in to comment.