Skip to content

Commit

Permalink
Clear the heap pages after enclave initialization
Browse files Browse the repository at this point in the history
Signed-off-by: Yu Yuan <yuan.yu@intel.com>
  • Loading branch information
Yu Yuan committed Dec 11, 2017
1 parent 160be9c commit 5fd7026
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sdk/trts/init_enclave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,16 @@ sgx_status_t do_init_enclave(void *ms)
{
if (0 != accept_post_remove(&g_global_data.layout_table[0], &g_global_data.layout_table[0] + g_global_data.layout_entry_num, 0))
return SGX_ERROR_UNEXPECTED;
size_t heap_min_size = get_heap_min_size();
memset_s(GET_PTR(void, enclave_base, g_global_data.heap_offset), heap_min_size, 0, heap_min_size);
}
else
#endif
{
memset_s(GET_PTR(void, enclave_base, g_global_data.heap_offset), g_global_data.heap_size, 0, g_global_data.heap_size);
}
g_enclave_state = ENCLAVE_INIT_DONE;
return SGX_SUCCESS;
}
Expand Down

0 comments on commit 5fd7026

Please sign in to comment.