On Tue, Jan 10, 2023 at 04:33:59PM +0000, Wilco Dijkstra via Gcc-patches wrote:
> Hi Szabolcs,
> 
> > i would keep the assert: how[reg] must be either UNSAVED or UNDEFINED
> > here, other how[reg] means the toggle cfi instruction is mixed with
> > incompatible instructions for the pseudo reg.
> >
> > and i would add a comment about this e.g. saying that UNSAVED/UNDEFINED
> > how[reg] is used for tracking the return address signing status and
> > other how[reg] is not allowed here.
> 
> I've added the assert back and updated the comment.

BTW, the patch doesn't apply to trunk cleanly (since the January 2nd
r13-4955-gcb775ecd6e437 commit).

> v3: Improve comments, add assert.
> 
> A recent change only initializes the regs.how[] during Dwarf unwinding
> which resulted in an uninitialized offset used in return address signing
> and random failures during unwinding.  The fix is to encode the return
> address signing state in REG_UNSAVED and REG_UNDEFINED.
> 
> Passes bootstrap & regress, OK for commit?
> 
> libgcc/
>         PR target/107678
>         * unwind-dw2.c (execute_cfa_program): Use REG_UNSAVED/UNDEFINED
>         to encode return address signing state.
>         * config/aarch64/aarch64-unwind.h (aarch64_demangle_return_addr)
>         Check current return address signing state.
>         (aarch64_frob_update_contex): Remove.

        Jakub

Reply via email to