[llvm-bugs] [Bug 47899] New: No backtrace on Linux for crashes due to stack overflow

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 19 04:19:17 PDT 2020


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: unassignedbugs at nondot.org
          Reporter: jannh at google.com
                CC: llvm-bugs at lists.llvm.org

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201019/18e375c4/attachment.html>


More information about the llvm-bugs mailing list