diff options
author | Dave Watson <dade.watson@gmail.com> | 2021-06-25 10:54:34 -0700 |
---|---|---|
committer | Dave Watson <dade.watson@gmail.com> | 2021-06-29 16:48:45 -0700 |
commit | bba4f44ed1a635458fa93ee36cda7e5c4a850a17 (patch) | |
tree | d877d9fc1eebaef238c18863ce0c012e48c2c390 /src/x86_64 | |
parent | ea49408206aeff31a2bf37df33ea12ff0ce16409 (diff) | |
download | libunwind-bba4f44ed1a635458fa93ee36cda7e5c4a850a17.tar.gz |
x86_64/GTrace: Fix usage of unsaved registers
Some cfis may access registers that aren't saved on the trace path.
Set all these registers to null locations, so that attempting to use
them causes us to fall back to the slow path.
Diffstat (limited to 'src/x86_64')
-rw-r--r-- | src/x86_64/Gtrace.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/x86_64/Gtrace.c b/src/x86_64/Gtrace.c index fa43c6a5..963a858f 100644 --- a/src/x86_64/Gtrace.c +++ b/src/x86_64/Gtrace.c @@ -207,10 +207,7 @@ trace_cache_get (void) RIP using current CFA, RBP and RSP values. Modifies CURSOR to that location, performs one unw_step(), and fills F with what was discovered about the location. Returns F. - - FIXME: This probably should tell DWARF handling to never evaluate - or use registers other than RBP, RSP and RIP in case there is - highly unusual unwind info which uses these creatively. */ +*/ static unw_tdep_frame_t * trace_init_addr (unw_tdep_frame_t *f, unw_cursor_t *cursor, @@ -238,6 +235,9 @@ trace_init_addr (unw_tdep_frame_t *f, their desired values. Then perform the step. */ d->ip = rip + d->use_prev_instr; d->cfa = cfa; + for(int i = 0; i < DWARF_NUM_PRESERVED_REGS; i++) { + d->loc[i] = DWARF_NULL_LOC; + } d->loc[UNW_X86_64_RIP] = DWARF_REG_LOC (d, UNW_X86_64_RIP); d->loc[UNW_X86_64_RBP] = DWARF_REG_LOC (d, UNW_X86_64_RBP); d->loc[UNW_X86_64_RSP] = DWARF_REG_LOC (d, UNW_X86_64_RSP); |