Skip to content

Commit

Permalink
Merge pull request #188 from yuyuany/heap_init
Browse files Browse the repository at this point in the history
Clear the heap pages after enclave initialization
  • Loading branch information
yuyuany authored Dec 11, 2017
2 parents 160be9c + 5fd7026 commit 3699ffd
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 3699ffd

Please sign in to comment.