public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: "Wilco Dijkstra" <Wilco.Dijkstra@arm.com>,
	"Martin Liška" <mliska@suse.cz>,
	"Kyrylo Tkachov" <Kyrylo.Tkachov@arm.com>,
	"Szabolcs Nagy" <Szabolcs.Nagy@arm.com>,
	"GCC Patches" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] libgcc: Fix uninitialized RA signing on AArch64 [PR107678]
Date: Thu, 12 Jan 2023 15:22:56 +0000	[thread overview]
Message-ID: <mptcz7jwze7.fsf@arm.com> (raw)
In-Reply-To: <Y8AbvuABbC5S5AI2@tucnak> (Jakub Jelinek's message of "Thu, 12 Jan 2023 15:39:58 +0100")

Jakub Jelinek <jakub@redhat.com> writes:
> 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).

If we have a new enum, I think we should handle it explicitly.  The fact
that the information isn't propagated between frames is a key part of
the semantics.

>> 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.

Yeah, personally I'd prefer for target-independent code to provide
the toggle representation, even if it isn't widely used.

Thanks,
Richard

  reply	other threads:[~2023-01-12 15:22 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-01 16:55 Wilco Dijkstra
2022-12-05 19:04 ` Richard Sandiford
2022-12-06 10:50   ` Szabolcs Nagy
2022-12-06 11:58     ` Wilco Dijkstra
2022-12-06 21:33       ` Szabolcs Nagy
2023-01-03 17:27   ` Wilco Dijkstra
2023-01-05 14:57     ` Szabolcs Nagy
2023-01-10 16:33       ` Wilco Dijkstra
2023-01-10 18:12         ` Jakub Jelinek
2023-01-11 11:33           ` Martin Liška
2023-01-11 11:59             ` Wilco Dijkstra
2023-01-12 10:49               ` Jakub Jelinek
2023-01-12 12:05                 ` Richard Sandiford
2023-01-12 12:08                   ` Richard Sandiford
2023-01-12 12:28                   ` Jakub Jelinek
2023-01-12 14:39                     ` Jakub Jelinek
2023-01-12 15:22                       ` Richard Sandiford [this message]
2023-01-12 15:34                         ` Jakub Jelinek
2023-01-12 15:40                           ` Richard Sandiford
2023-01-12 18:57         ` Jakub Jelinek
2023-01-16 13:04           ` Martin Liška
2023-01-17 19:49             ` Wilco Dijkstra
2023-01-17 20:43               ` Richard Sandiford
2023-01-18 12:49                 ` Wilco Dijkstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mptcz7jwze7.fsf@arm.com \
    --to=richard.sandiford@arm.com \
    --cc=Kyrylo.Tkachov@arm.com \
    --cc=Szabolcs.Nagy@arm.com \
    --cc=Wilco.Dijkstra@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=mliska@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).