This repository has been archived by the owner on Jan 30, 2024. It is now read-only.
Change unwinder to mark registers as "unknown" when they don't appear in an unwind table row #284
Labels
difficulty: medium
Somewhat difficult to solve
status: needs PR
Issue just needs a Pull Request implementing the changes
topic: unwinding
type: bug
Something isn't working
Before unwinding is started, all registers have the value in the physical CPU registers. During unwinding, we use the rules in the matching unwind table row to restore all registers to their value in the previous frame:
probe-run/src/backtrace/unwind.rs
Lines 76 to 80 in a826c79
However, there's an implicit rule that we currently ignore: if a register does not appear in that list, its value is lost and can not be recovered. Currently, we just leave it at its old value, which can cause the unwinder to veer off into memory it shouldn't touch.
We should change the unwinder to track "unrecoverable" registers, and make it bail out when a register it needs (mostly LR or PC, SP is handled differently) is unrecoverable.
Note that this has the chance of affecting real-world programs that just happen to unwind correctly despite unrecoverable registers, but I think those should be rare (rustc tries to keep registers needed for unwinding intact).
The text was updated successfully, but these errors were encountered: