Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
To: Matthieu Longo <matthieu.longo@arm.com>
Cc: gdb-patches@sourceware.org,  Tom Tromey <tom@tromey.com>,
	 Andrew Burgess <aburgess@redhat.com>
Subject: Re: [PATCH v1] gdb: align siginfo_t with the Linux kernel definition
Date: Wed, 17 Jun 2026 06:07:36 +0000	[thread overview]
Message-ID: <87se6lhf87.fsf@linaro.org> (raw)
In-Reply-To: <63fce133-4d28-4629-9a60-6d14cba49b86@arm.com> (Matthieu Longo's message of "Fri, 12 Jun 2026 11:42:45 +0100")

Hello Matthieu,

Matthieu Longo <matthieu.longo@arm.com> writes:

> On 12/06/2026 11:16, Matthieu Longo wrote:
>> GDB's current definition of siginfo_t is missing many fields present in
>> the Linux kernel definition [1].
>> These fields are useful for providing detailed, user-friendly diagnostics
>> when a fault occurs. Some new AArch64 extensions, such as Permission
>> Overlay Enhancement used to implement Protection Keys [2], require the
>> debugger to inspect 'si_pkey' alongside 'si_addr' to help the user identify
>> the problematic key.
>> This patch aligns GDB's definition of the __sifields._sigfault member of
>> siginfo_t with the definition from the Linux kernel master branch.
>> [1]: https://github.com/torvalds/linux/blob/2b414a95b8f7307d42173ba9e580d6
>>       d3e2bcbfce/include/uapi/asm-generic/siginfo.h#L69-L100
>> [2]: https://lore.kernel.org/all/20160212210213.ABC488FA@viggo.jf.intel.com/
>> ---
>>   gdb/linux-tdep.c | 39 +++++++++++++++++++++++++++++++++++++--
>>   1 file changed, 37 insertions(+), 2 deletions(-)
>> 
> I was not sure who I should include for the review. Please feel free to CC the right
> persons if they are not already in the list.
>
> I tested the patch above, and it seems to work fine without any change in ./gdb/nat
> However, in my understanding, compat_siginfo_t should also be impacted. Why is it still
> working then without any change ?
> aarch64_siginfo_from_compat_siginfo (in gdb/nat/aarch64-linux.c) and its friends for each
> backend seem to provide some conversion logic between the siginfo_t from the system
> (/usr/include/asm-generic/siginfo.h) and some internal representation compat_siginfo_t.
> From my research, this seems needed because, if the host and target systems are not using
> the same ABI (endianness, size of a pointer or int, etc...), GDB cannot rely on the local
> definition of siginfo_t to interpret correctly the data in the blob that it received from
> the target.

compat_siginfo_t is used when the inferior is an AArch32 process while
GDB is AArch64. This will cause the 64-bit kernel to use the syscall
compatibility layer — and thus the 32-bit definition of siginfo_t —
which GDB's compat_siginfo_t aims to represent.

> However, I am confused by the definition of compat_siginfo_t in gdb/nat/aarch64-linux.h
> for instance. I see that addresses like _sigfaul._addr are converted to 'unsigned int'
> (that should be equivalent to uint32_t I guess). Why is this working ?
>
> Please, could you provide explanations on the above, and guidances on the changes required
> in struct compat_siginfo_t ?

I'm not sure I understand why it wouldn't work. In the example of
_sigfault._addr, it is an unsigned int (equivalent to uint32_t as you
point out) so it will match the width of the void * used for the
corresponding void * field in 32-bit userspace. This is converted to
siginfo_t's 64-bit void * in aarch64_siginfo_from_compat_siginfo with:

  to->si_addr = (void *) (intptr_t) from->cpt_si_addr;

Do you see a problem in this process?

-- 
Thiago
(he/him)

  reply	other threads:[~2026-06-17  6:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12 10:16 Matthieu Longo
2026-06-12 10:42 ` Matthieu Longo
2026-06-17  6:07   ` Thiago Jung Bauermann [this message]
2026-06-17  9:11     ` Matthieu Longo
2026-06-18  3:02       ` Thiago Jung Bauermann
2026-06-18 14:02         ` Matthieu Longo
2026-06-18 16:23           ` Thiago Jung Bauermann
2026-06-19  3:58 ` Thiago Jung Bauermann
2026-06-19 10:45   ` Matthieu Longo
2026-06-22  8:42     ` Matthieu Longo
2026-06-24 21:45       ` Thiago Jung Bauermann
2026-06-25  9:55         ` Matthieu Longo

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=87se6lhf87.fsf@linaro.org \
    --to=thiago.bauermann@linaro.org \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=matthieu.longo@arm.com \
    --cc=tom@tromey.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