[PATCH] libgcc: Fix uninitialized RA signing on AArch64 [PR107678]
Jakub Jelinek
jakub@redhat.com
Thu Jan 12 14:39:58 GMT 2023
On Thu, Jan 12, 2023 at 01:28:59PM +0100, Jakub Jelinek wrote:
> > Although we don't AFAIK support using DW_CFA_undefined with RA signing,
> > the failure mode would be non-obvious: it would effectively toggle the
> > bit on.
>
> We don't install unwind-dw2.h nor give user code access to the how array
> (and it just lives on the stack of __frame_state_for/uw_init_context_1
> functions and address of it is passed to functions called from it),
> so I hope all this is private to the libgcc unwinder. After all, otherwise
> e.g. the change how "how" is represented couldn't be done.
> That said, if new enum entries are added in the generic code, then
> I think uw_update_context_1 will warn about unhandled case in a switch,
> unless we e.g. change
> case REG_UNSAVED:
> case REG_UNDEFINED:
> break;
> to
> default:
> break;
> (and provided that the new enums would want such handling).
> Another option is to just define the arch dependent value for how field
> in the arch code, right now it is unsigned char type, so using say
> (unsigned char) ~0 or (unsigned char) ~0 and (unsigned char) ~1 as arch
> specific values might be ok too.
Yet another option would be to define 1-2 extra REG_ values in the generic
unwind-dw2.h header, but name them
REG_ARCH_SPECIFIC_1,
REG_ARCH_SPECIFIC_2,
or so, and then the machine specific code can
#define REG_AARCH64_TOGGLE_ON REG_ARCH_SPECIFIC_1
Of course, all this depends on whether the arch specific codes can be
handled in uw_update_context_1 by doing break; there and nothing else.
Jakub
More information about the Gcc-patches
mailing list