diff options
author | SihangZhu <zhusihang@huawei.com> | 2024-01-16 10:13:11 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-16 10:13:11 +0800 |
commit | 58b33d0301a36900fc641b4b0e110b683064bab8 (patch) | |
tree | 6dd20e8e1a049530b2d998b0eb1a8c7ba1baca3a /libunwind/src | |
parent | 2c0fc0f37f29d54e0376a5e1f7cbb386a37a177d (diff) | |
download | llvm-58b33d0301a36900fc641b4b0e110b683064bab8.zip llvm-58b33d0301a36900fc641b4b0e110b683064bab8.tar.gz llvm-58b33d0301a36900fc641b4b0e110b683064bab8.tar.bz2 |
[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.
Diffstat (limited to 'libunwind/src')
-rw-r--r-- | libunwind/src/libunwind.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libunwind/src/libunwind.cpp b/libunwind/src/libunwind.cpp index cd61037..723c8ce 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) { |