https://github.com/SihangZhu updated https://github.com/llvm/llvm-project/pull/77185
>From b9957ac0a33c9ee0f1144862621fcea8f33a1d69 Mon Sep 17 00:00:00 2001 From: SihangZhu <zhusih...@huawei.com> Date: Sat, 6 Jan 2024 15:43:41 +0800 Subject: [PATCH] [libunwind] Add length info for .eh_frame registration --- libunwind/src/libunwind.cpp | 6 ++++-- libunwind/src/libunwind_ext.h | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/libunwind/src/libunwind.cpp b/libunwind/src/libunwind.cpp index cd610377b63de8..e57bf9504c0b6c 100644 --- a/libunwind/src/libunwind.cpp +++ b/libunwind/src/libunwind.cpp @@ -318,13 +318,15 @@ void __unw_remove_dynamic_fde(unw_word_t fde) { DwarfFDECache<LocalAddressSpace>::removeAllIn((LocalAddressSpace::pint_t)fde); } -void __unw_add_dynamic_eh_frame_section(unw_word_t eh_frame_start) { +void __unw_add_dynamic_eh_frame_section(unw_word_t eh_frame_start, + size_t length) { // The eh_frame section start serves as the mh_group unw_word_t mh_group = eh_frame_start; CFI_Parser<LocalAddressSpace>::CIE_Info cieInfo; CFI_Parser<LocalAddressSpace>::FDE_Info fdeInfo; auto p = (LocalAddressSpace::pint_t)eh_frame_start; - while (true) { + auto end = p + length; + while (p < end) { if (CFI_Parser<LocalAddressSpace>::decodeFDE( LocalAddressSpace::sThisAddressSpace, p, &fdeInfo, &cieInfo, true) == NULL) { diff --git a/libunwind/src/libunwind_ext.h b/libunwind/src/libunwind_ext.h index 28db43a4f6eef2..acc1551e14d71a 100644 --- a/libunwind/src/libunwind_ext.h +++ b/libunwind/src/libunwind_ext.h @@ -55,7 +55,8 @@ extern void __unw_iterate_dwarf_unwind_cache(void (*func)( extern void __unw_add_dynamic_fde(unw_word_t fde); extern void __unw_remove_dynamic_fde(unw_word_t fde); -extern void __unw_add_dynamic_eh_frame_section(unw_word_t eh_frame_start); +extern void __unw_add_dynamic_eh_frame_section(unw_word_t eh_frame_start, + size_t length); extern void __unw_remove_dynamic_eh_frame_section(unw_word_t eh_frame_start); #ifdef __APPLE__ _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits