This is an archive of the discontinued LLVM Phabricator instance.

eSupport] Don't modify the current EH context during stack unwinding
ClosedPublic

Authored by rnk on Jan 31 2020, 2:41 PM.

Details

Summary

Copy it instead. Otherwise, key registers (such as RBP) may get zeroed
out by the stack unwinder.

Fixes CrashRecoveryTest.DumpStackCleanup with MSVC in release builds.

Diff Detail

Event Timeline

rnk created this revision.Jan 31 2020, 2:41 PM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: hiraditya. · View Herald Transcript
stella.stamenova accepted this revision.Jan 31 2020, 2:53 PM

LGTM and I verified that the test now passes.

This revision is now accepted and ready to land.Jan 31 2020, 2:53 PM

Unit tests: pass. 62373 tests passed, 0 failed and 839 were skipped.

clang-tidy: fail. clang-tidy found 1 errors and 0 warnings. 0 of them are added as review comments below (why?).

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

This revision was automatically updated to reflect the committed changes.
aganea added a comment.Feb 1 2020, 7:04 AM

Thanks Reid for looking into this! So I suppose the problem is related to llvm-symbolizer not being invoked somehow in Stella's case? This seems to occur if either that exe is not in %PATH% or if printSymbolizedStackTrace() can't create the input/output files for symbolizer. Was that the bug?
And it looks like the llvm-symbolizer codepath already duplicates the CONTEXT like you do here, but then the fallback Dbghelp.dll doesn't duplicate, which most likely caused this issue.

aganea added inline comments.Feb 1 2020, 7:11 AM
llvm/lib/Support/Windows/Signals.inc
234

This part is duplicating the context.

311

This one is not (and is inherently corrected by your fix).

Ideally it'd be nice to factor out the stackwalk code, duplicated behavior always ends up leading to bad things :-)