https://bugs.llvm.org/show_bug.cgi?id=47899

            Bug ID: 47899
           Summary: No backtrace on Linux for crashes due to stack
                    overflow
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Support Libraries
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

The signal handlers LLVM installs in RegisterHandlers() (used for things
like printing a stack trace) use SA_ONSTACK so that on stack overflow,
the signal handler still has a stack from which it can run.

However, CrashRecoveryContext overwrites those signal handlers with ones
without SA_ONSTACK. Therefore, if the stack overflows while a
CrashRecoveryContext is active, the kernel fails to write a signal frame
and terminates the process, which means that LLVM won't print a
backtrace.

You can e.g. test this by calling an endlessly recursing function
directly below the call to llvm::CrashRecoveryContext::Enable() in
clang/tools/driver/driver.cpp.

I have sent a patch for this for review: https://reviews.llvm.org/D89442

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to