Skip to content

Commit ce4a18d

Browse files
authored
Merge pull request #571 from lzha101/fix_large_rsrv_mem
Fix bug of setting large reserved momory. Signed-off-by: Zhang Lili Z lili.z.zhang@intel.com
2 parents 7c2e2f9 + adaeb2a commit ce4a18d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

psw/urts/loader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ int CLoader::set_memory_protection()
861861
{
862862
if (layout->entry.id == LAYOUT_ID_RSRV_MIN && layout->entry.si_flags == SI_FLAGS_RWX && layout->entry.page_count > 0)
863863
{
864-
ret = get_enclave_creator()->emodpr((uint64_t)m_start_addr + layout->entry.rva, layout->entry.page_count << SE_PAGE_SHIFT, (uint64_t)(SI_FLAG_R |SI_FLAG_W ));
864+
ret = get_enclave_creator()->emodpr((uint64_t)m_start_addr + layout->entry.rva, (uint64_t)layout->entry.page_count << SE_PAGE_SHIFT, (uint64_t)(SI_FLAG_R |SI_FLAG_W ));
865865
if (ret != SGX_SUCCESS)
866866
return SGX_ERROR_UNEXPECTED;
867867
break;

sdk/trts/linux/elf_parser.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ sgx_status_t change_protection(void *enclave_base)
540540
if (g_global_data.layout_table[i].entry.id == LAYOUT_ID_RSRV_MIN && g_global_data.layout_table[i].entry.si_flags == SI_FLAGS_RWX && g_global_data.layout_table[i].entry.page_count > 0)
541541
{
542542
if((status = trts_mprotect((size_t)((size_t)enclave_base + g_global_data.layout_table[i].entry.rva),
543-
g_global_data.layout_table[i].entry.page_count << SE_PAGE_SHIFT,
543+
(size_t)g_global_data.layout_table[i].entry.page_count << SE_PAGE_SHIFT,
544544
SI_FLAG_R|SI_FLAG_W)) != SGX_SUCCESS)
545545
return status;
546546
break;

0 commit comments

Comments
 (0)