[libunwind] 58b33d0 - [libunwind] fix dynamic .eh_frame registration (#77185)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 15 18:13:15 PST 2024
Author: SihangZhu
Date: 2024-01-16T10:13:11+08:00
New Revision: 58b33d0301a36900fc641b4b0e110b683064bab8
URL: https://github.com/llvm/llvm-project/commit/58b33d0301a36900fc641b4b0e110b683064bab8
DIFF: https://github.com/llvm/llvm-project/commit/58b33d0301a36900fc641b4b0e110b683064bab8.diff
LOG: [libunwind] fix dynamic .eh_frame registration (#77185)
Fix this issue
[#76957](https://github.com/llvm/llvm-project/issues/76957)
Libgcc provides __register_frame to register a dynamic .eh_frame
section, while __unw_add_dynamic_eh_frame_section can be used to do the
same in libunwind. However, the address after dynamic .eh_frame are
padding with 0 value, it will be identified as
legal CIE. And __unw_add_dynamic_eh_frame_section will continue to parse
subsequent addresses until illegal memory or other sections are
accessed.
This patch adds length formal parameter for dynamic registration.
Added:
Modified:
libunwind/src/libunwind.cpp
Removed:
################################################################################
diff --git a/libunwind/src/libunwind.cpp b/libunwind/src/libunwind.cpp
index cd610377b63de8..723c8ceb5c8c94 100644
--- a/libunwind/src/libunwind.cpp
+++ b/libunwind/src/libunwind.cpp
@@ -324,7 +324,7 @@ void __unw_add_dynamic_eh_frame_section(unw_word_t 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) {
+ while (LocalAddressSpace::sThisAddressSpace.get32(p)) {
if (CFI_Parser<LocalAddressSpace>::decodeFDE(
LocalAddressSpace::sThisAddressSpace, p, &fdeInfo, &cieInfo,
true) == NULL) {
More information about the cfe-commits
mailing list