This is an automated email from the ASF dual-hosted git repository. rduan pushed a commit to branch v2.0.0-preview in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-sgx-sdk.git
commit d2656c6f1075f494a9053170ec65731cf7a16359 Author: volcano <[email protected]> AuthorDate: Mon Mar 27 10:19:18 2023 +0800 Fix backtrace access to illegal memory --- sgx_backtrace/sgx_backtrace_sys/libbacktrace/elf.c | 30 ++++++++++------------ sgx_unwind/libunwind/src/x86_64/Ginit.c | 10 ++++---- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/sgx_backtrace/sgx_backtrace_sys/libbacktrace/elf.c b/sgx_backtrace/sgx_backtrace_sys/libbacktrace/elf.c index 7bf46b65..4b493ef2 100644 --- a/sgx_backtrace/sgx_backtrace_sys/libbacktrace/elf.c +++ b/sgx_backtrace/sgx_backtrace_sys/libbacktrace/elf.c @@ -3000,22 +3000,20 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor, debug_view_valid = 0; } - if (!backtrace_dwarf_add (state, base_address, - sections[DEBUG_INFO].data, - sections[DEBUG_INFO].size, - sections[DEBUG_LINE].data, - sections[DEBUG_LINE].size, - sections[DEBUG_ABBREV].data, - sections[DEBUG_ABBREV].size, - sections[DEBUG_RANGES].data, - sections[DEBUG_RANGES].size, - sections[DEBUG_STR].data, - sections[DEBUG_STR].size, - ehdr.e_ident[EI_DATA] == ELFDATA2MSB, - error_callback, data, fileline_fn)) - goto fail; - - *found_dwarf = 1; + if (backtrace_dwarf_add (state, base_address, + sections[DEBUG_INFO].data, + sections[DEBUG_INFO].size, + sections[DEBUG_LINE].data, + sections[DEBUG_LINE].size, + sections[DEBUG_ABBREV].data, + sections[DEBUG_ABBREV].size, + sections[DEBUG_RANGES].data, + sections[DEBUG_RANGES].size, + sections[DEBUG_STR].data, + sections[DEBUG_STR].size, + ehdr.e_ident[EI_DATA] == ELFDATA2MSB, + error_callback, data, fileline_fn)) + *found_dwarf = 1; return 1; diff --git a/sgx_unwind/libunwind/src/x86_64/Ginit.c b/sgx_unwind/libunwind/src/x86_64/Ginit.c index cf65579c..7bbd1db2 100644 --- a/sgx_unwind/libunwind/src/x86_64/Ginit.c +++ b/sgx_unwind/libunwind/src/x86_64/Ginit.c @@ -134,11 +134,11 @@ write_validate (void *addr) static int (*mem_validate_func) (void *addr, size_t len); static int msync_validate (void *addr, size_t len) { - // #ifdef HAVE_SGX - // extern int sgx_is_within_enclave(const void *addr, size_t size); - // if(!sgx_is_within_enclave(addr, len)) - // abort(); - // #endif +#ifdef HAVE_SGX + extern int sgx_is_within_enclave(const void *addr, size_t size); + if(!sgx_is_within_enclave(addr, len)) + abort(); +#endif if (msync (addr, len, MS_ASYNC) != 0) { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
