Skip to content

[libunwind][AIX] Fix the wrong traceback from signal handler #101069

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 30, 2024

Conversation

xingxue-ibm
Copy link
Contributor

Patch llvm#92291 causes wrong traceback from a signal handler for AIX because the AIX unwinder uses the traceback table at the end of each function instead of FDE/CIE for unwinding. This patch adds a condition to exclude traceback table based unwinding from the code added by the patch.

@xingxue-ibm xingxue-ibm requested review from compnerd and daltenty July 29, 2024 19:19
@xingxue-ibm xingxue-ibm self-assigned this Jul 29, 2024
@xingxue-ibm xingxue-ibm requested a review from a team as a code owner July 29, 2024 19:19
@llvmbot
Copy link
Member

llvmbot commented Jul 29, 2024

@llvm/pr-subscribers-libunwind

Author: Xing Xue (xingxue-ibm)

Changes

Patch llvm#92291 causes wrong traceback from a signal handler for AIX because the AIX unwinder uses the traceback table at the end of each function instead of FDE/CIE for unwinding. This patch adds a condition to exclude traceback table based unwinding from the code added by the patch.


Full diff: https://github.com/llvm/llvm-project/pull/101069.diff

1 Files Affected:

  • (modified) libunwind/src/UnwindCursor.hpp (+2-1)
diff --git a/libunwind/src/UnwindCursor.hpp b/libunwind/src/UnwindCursor.hpp
index 2ec60e4c123d5..758557337899e 100644
--- a/libunwind/src/UnwindCursor.hpp
+++ b/libunwind/src/UnwindCursor.hpp
@@ -2589,7 +2589,8 @@ void UnwindCursor<A, R>::setInfoBasedOnIPRegister(bool isReturnAddress) {
     --pc;
 #endif
 
-#if !(defined(_LIBUNWIND_SUPPORT_SEH_UNWIND) && defined(_WIN32))
+#if !(defined(_LIBUNWIND_SUPPORT_SEH_UNWIND) && defined(_WIN32)) &&            \
+    !defined(_LIBUNWIND_SUPPORT_TBTAB_UNWIND)
   // In case of this is frame of signal handler, the IP saved in the signal
   // handler points to first non-executed instruction, while FDE/CIE expects IP
   // to be after the first non-executed instruction.

@daltenty daltenty added this to the LLVM 19.X Release milestone Jul 29, 2024
Copy link
Member

@daltenty daltenty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tru tru force-pushed the fix-pr92291-for-aix branch from c5176fb to 1d5e5ec Compare July 30, 2024 06:35
@xingxue-ibm xingxue-ibm merged commit d90fa61 into llvm:main Jul 30, 2024
54 checks passed
@daltenty
Copy link
Member

/cherry-pick d90fa61

llvmbot pushed a commit to llvmbot/llvm-project that referenced this pull request Jul 30, 2024
…1069)

Patch [llvm#92291](llvm#92291)
causes wrong traceback from a signal handler for AIX because the AIX
unwinder uses the traceback table at the end of each function instead of
FDE/CIE for unwinding. This patch adds a condition to exclude traceback
table based unwinding from the code added by the patch.

(cherry picked from commit d90fa61)
@llvmbot
Copy link
Member

llvmbot commented Jul 30, 2024

/pull-request #101182

tru pushed a commit to llvmbot/llvm-project that referenced this pull request Jul 31, 2024
…1069)

Patch [llvm#92291](llvm#92291)
causes wrong traceback from a signal handler for AIX because the AIX
unwinder uses the traceback table at the end of each function instead of
FDE/CIE for unwinding. This patch adds a condition to exclude traceback
table based unwinding from the code added by the patch.

(cherry picked from commit d90fa61)
@xingxue-ibm xingxue-ibm deleted the fix-pr92291-for-aix branch April 1, 2025 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

4 participants