Skip to content

release/19.x: [libunwind][AIX] Fix the wrong traceback from signal handler (#101069) #101182

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 1 commit into from
Jul 31, 2024

Conversation

llvmbot
Copy link
Member

@llvmbot llvmbot commented Jul 30, 2024

Backport d90fa61

Requested by: @daltenty

@llvmbot llvmbot requested a review from a team as a code owner July 30, 2024 13:17
@llvmbot llvmbot added this to the LLVM 19.X Release milestone Jul 30, 2024
@llvmbot
Copy link
Member Author

llvmbot commented Jul 30, 2024

@compnerd What do you think about merging this PR to the release branch?

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

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

This is good to include on the release branch, it should be safe and fixes the behavior on AIX.

…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)
@tru tru merged commit 64699d3 into llvm:release/19.x Jul 31, 2024
7 of 8 checks passed
@llvmbot
Copy link
Member Author

llvmbot commented Jul 31, 2024

@llvm/pr-subscribers-libunwind

Author: None (llvmbot)

Changes

Backport d90fa61

Requested by: @daltenty


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

2 Files Affected:

  • (modified) libunwind/src/UnwindCursor.hpp (+2-1)
  • (modified) libunwind/test/aix_signal_unwind.pass.sh.S (+1-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.
diff --git a/libunwind/test/aix_signal_unwind.pass.sh.S b/libunwind/test/aix_signal_unwind.pass.sh.S
index 9ca18e9481f4f..a666577d095b1 100644
--- a/libunwind/test/aix_signal_unwind.pass.sh.S
+++ b/libunwind/test/aix_signal_unwind.pass.sh.S
@@ -10,7 +10,7 @@
 // a correct traceback when the function raising the signal does not save
 // the link register or does not store the stack back chain.
 
-// REQUIRES: target=powerpc{{(64)?}}-ibm-aix
+// REQUIRES: target=powerpc{{(64)?}}-ibm-aix{{.*}}
 
 // Test when the function raising the signal does not save the link register
 // RUN: %{cxx} -x c++ %s -o %t.exe -DCXX_CODE %{flags} %{compile_flags}

Copy link

@daltenty (or anyone else). If you would like to add a note about this fix in the release notes (completely optional). Please reply to this comment with a one or two sentence description of the fix. When you are done, please add the release:note label to this PR.

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