getsentry/symbolic

Investigate macOS Unwinding involving `_sigtramp`

Swatinem opened this issue · 0 comments

Similar to #638, we have a customer (with retained minidumps and usable debug files; sentry employees should know which one I mean) that reports incomplete / truncated stack traces for macOS minidumps that involve _sigtramp.

That particular function seems to have some hand-crafted DWARF code that restores the caller context from the callee stack via the $rbx register:

https://github.com/apple/darwin-libplatform/blob/215b09856ab5765b7462a91be7076183076600df/src/setjmp/x86_64/_sigtramp.s#L198-L258

I have translated this into some hand-crafted ASCII CFI in #389

The investigation should focus on the following points:

  • Re-evaluate the hand-crafted CFI. Why can’t we just handle the DWARF expression directly? Either remove the hardcoded CFI, or expand on the comment why exactly it is necessary.
  • Our hardcoded CFI only restores a limited set of registers, we should maybe expand it to restore all the registers that are available.
  • The CFI relies on the $rbx register being available. Is it? If not, why? And can we get it from somewhere?
  • NOTE: $rbx is a preserved / non-volatile / callee saves register. So if CFI does not explicitly state how to restore it, we should be able to assume it is not modified by the function.
  • _sigtramp loads the complete caller context (rip / rsp) from its own stack. That $rsp might as well run into the restrictions explained here: rust-minidump/rust-minidump#637