Prevent unwinding through stack bottom (#81770)
authorJan Vorlicek <janvorli@microsoft.com>
Wed, 8 Feb 2023 00:47:32 +0000 (01:47 +0100)
committerGitHub <noreply@github.com>
Wed, 8 Feb 2023 00:47:32 +0000 (01:47 +0100)
commit215839ee5c05547cd740d98cea34f15e73bd5bbb
tree490152c0e7b966503b6429117172ce95879cc8cc
parent59dddfdef247b9b85a69d663a1d1c1746206711e
Prevent unwinding through stack bottom (#81770)

When processing unhandled exception on the most recent Alpine 3.17,
the libunwind doesn't stop at the bottom
frame of the main thread (the caller of `main`) and tries to unwind
further. The reason is that the method is missing dwarf unwind
information, so the libunwind falls back to using RBP chain, but the RBP
points to a garbage and so it ends up crashing with SIGSEGV.

While the missing DWARF unwind info seems to be a bug in the Alpine 3.17
(older ones work fine), we can prevent issues like this by stopping at
the hosting API boundary and not trying to unwind past that. This is
what this PR does.
src/coreclr/dlls/mscoree/exports.cpp
src/coreclr/vm/exceptionhandling.cpp