Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Klaus Gerlicher <klaus.gerlicher@intel.com>
To: gdb-patches@sourceware.org, luis.machado@arm.com
Subject: [PATCH 1/1] aarch64: fix a crash during maintenance print cooked-registers
Date: Mon,  3 Feb 2025 13:52:40 +0000	[thread overview]
Message-ID: <20250203135240.1030561-1-klaus.gerlicher@intel.com> (raw)

Hi all, Luis,

I found this accidently while looking at Thiago's GDBserver improvements. Luis
I think added the pseudo register in question, so maybe he can comment
on this issue. I used a aarch64 qemu 9.2.

Thanks
Klaus

On aarch64 with pauth enabled I can see a crash when
using "maintenance print cooked-registers".

This happens because the register dump code tries to read
a pseudo reg that is not handled here because it is supposedly
only used in unwinding.

Fix this by returning a zero value typed as a built-in uint64.
---
 gdb/aarch64-tdep.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 840f9877361..6e712b12b86 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -3290,6 +3290,9 @@ aarch64_pseudo_read_value (gdbarch *gdbarch, const frame_info_ptr &next_frame,
     return aarch64_pseudo_read_value_1 (next_frame, pseudo_reg_num,
 					pseudo_offset - AARCH64_SVE_V0_REGNUM);
 
+  if (tdep->has_pauth () && pseudo_reg_num == tdep->ra_sign_state_regnum)
+    return value::zero (builtin_type (gdbarch)->builtin_uint64, lval_register);
+
   gdb_assert_not_reached ("regnum out of bound");
 }
 
-- 
2.34.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


             reply	other threads:[~2025-02-03 13:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-03 13:52 Klaus Gerlicher [this message]
2025-02-03 14:27 ` Luis Machado
2025-02-03 14:38   ` Gerlicher, Klaus
2025-02-03 14:40     ` Luis Machado
2025-02-13 11:09       ` [PUSHED][PATCH " Gerlicher, Klaus

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=20250203135240.1030561-1-klaus.gerlicher@intel.com \
    --to=klaus.gerlicher@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=luis.machado@arm.com \
    /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