[PATCH v3 0/5] gdb/aarch64: Add POR_EL0 register support for FEAT_S1POE

<[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
From: Srinath Parvathaneni <[email protected]>

Changes v2 -> v3:

Patch 1:
* Address review comments.
* After discussion, retain the _EL0 suffix for the POE register.
* Merge the POR_EL0 custom printing support from v2 Patch 2.
* Update the XML description to use the POR_EL0_FLAGS type for
  custom register printing.

Patch 2:
* Corresponds to v2 Patch 3.
* No functional changes.
* Approved by Thiago Jung Bauermann.

Patch 3:
* Corresponds to v2 Patch 4.
* No functional changes.
* Approved by Thiago Jung Bauermann.

Patch 4:
* The BFD/readelf changes from v2 Patch 5 have been posted separately
  to binutils-gdb and have since been approved and committed.
* Corresponds to v2 Patch 6.
* Address review comments on the GDB core file support.

Patch 5:
* Corresponds to v2 Patch 7.
* Address review comments.
* Update the tests to reflect the POR_EL0 custom string shown by
  `info registers por_el0` and `print $por_el0`.
* Fix aarch64-poe-core.exp test issues.

* Rebased onto current upstream master, including:
  * Matthieu Longo's "gdb: align siginfo_t with the Linux kernel definition".
  * My "gdb: Fix assignment to TYPE_CODE_FLAGS registers" patch.
----------------

Changes v1 -> v2:

* Rebased the SIGSEGV diagnostic support on Matthieu Longo's generic
  "siginfo_t" changes, using the new "_._addr_pkey.si_pkey" layout
  instead of introducing a target-specific "siginfo_t" extension.

* Split the original series into smaller, subsystem-specific patches:
  * GDB register support
  * POR_EL0 pretty printing
  * SIGSEGV diagnostics
  * gdbserver support
  * BFD/readelf core file support
  * GDB core file support
  * Testsuite

* Separated BFD/readelf and GDB core file support into independent
  patches.

* Retained FEAT_S1POE expansion as "Permission Overlay Extension" after internal discussion.

* Removed the POR_EL0 permission decoding string (e.g. `por_el0[pkey=<value>] = rwx`) from
  SIGSEGV diagnostics, as displaying permissions without also showing base and effective
  permissions can be misleading to users.

* Rebased the series onto current upstream master + Matthieu's patch
  "gdb: align siginfo_t with the Linux kernel definition"

----------------

Hi,

This series adds support for the AArch64 Permission Overlay Extension
(FEAT_S1POE) in GDB and gdbserver.

The series introduces support for the POR_EL0 register, allowing GDB
to read and write it using the Linux NT_ARM_POE regset. It also improves
SIGSEGV diagnostics for Permission Overlay violations, extends gdbserver
to transfer POR_EL0 during remote debugging, restores POR_EL0 from core
files, and adds testsuite coverage.

The BFD/readelf support for the NT_ARM_POE core note has already been
posted and approved separately.

commit d15490528409305f97004a2860fdb04543862774
Author: Srinath Parvathaneni <[email protected]>
Date:   Thu Jul 2 13:57:25 2026 +0000

    bfd/readelf: Add core file support for FEAT_S1POE


The series consists of the following patches:

[1/5] gdb/aarch64: Add POR_EL0 register support
Add support for reading and writing the POR_EL0 register using the Linux
NT_ARM_POE regset.

[2/5] gdb: Improve SIGSEGV diagnostics for POE faults
Report the faulting address together with the associated protection key
for Permission Overlay violations.

[3/5] gdbserver/aarch64: Add POR_EL0 register support
Transfer the POR register through the Linux NT_ARM_POE regset during
remote debugging.

[4/5] gdb/aarch64: Add core file support for FEAT_S1POE
Restore the POR_EL0 register from Linux core files and signal frames.

[5/5] gdb/testsuite: Add FEAT_S1POE testcases
Add tests covering POR_EL0 register access, SIGSEGV diagnostics,
fix-and-continue support, and core file support.

The series has been tested natively and using gdbserver with remote GDB
on an FVP built using shrinkwrap with a Linux kernel configured with
CONFIG_ARM64_POE=y and a glibc version providing userspace POE support.

Regression tested on aarch64-none-linux-gnu with no regressions.

Ok for GDB master?

----------
>> This series adds support for the AArch64 Permission Overlay Extension
>> (FEAT_S1POE) in GDB, gdbserver, BFD and the testsuite.
>
> Hi Srinath!
>
> I don't know much about the arm architecture or this extension in 
> specific, but it seems that it at least adds new registers so this seems 
> like a valid question: Do these impact recording of ARM instructions 
> with the record-full subsystem at all?
> 
> It would be nice to have a gdb.reverse test that exercises some (ideally 
> all) new instructions if there are any, and some other instructions that 
> manipulate those new registers, if needed.
> 
> This isn't required to get this series merged, of course, but it would 
> be very nice to have it.

Hi Guinevere,

As far as I understand, FEAT_S1POE doesn't introduce any new AArch64
instructions in userspace, it only exposes the POR_EL0 register, which
is accessed through the Linux Protection-key APIs. The register itself
is managed by the kernel rather than being modified by normal AArch64
instructions. Because of that, I don't think this support has any impact
on the record-full subsystem.

Thanks for the suggestion about adding gdb.reverse tests. I'll keep that
in mind for other feature support.

Regards,
Srinath

Srinath Parvathaneni (5):
  gdb/aarch64: Add POR_EL0 register support for FEAT_S1POE
  gdb: Improve SIGSEGV diagnostics for POE faults
  gdbserver/aarch64: Add POR_EL0 register support
  gdb/aarch64: Add core file support for FEAT_S1POE
  gdb/testsuite: Add FEAT_S1POE testcases

 gdb/Makefile.in                               |   2 +
 gdb/aarch64-linux-nat.c                       |  64 +++++++++++
 gdb/aarch64-linux-tdep.c                      |  71 +++++++++++-
 gdb/aarch64-tdep.c                            |  23 ++++
 gdb/aarch64-tdep.h                            |  10 ++
 gdb/arch/aarch64-poe-linux.h                  |  29 +++++
 gdb/arch/aarch64.c                            |   4 +
 gdb/arch/aarch64.h                            |   8 +-
 gdb/features/Makefile                         |   1 +
 gdb/features/aarch64-poe.c                    |  68 ++++++++++++
 gdb/features/aarch64-poe.xml                  |  47 ++++++++
 gdb/nat/aarch64-poe-linux.h                   |  29 +++++
 gdb/testsuite/gdb.arch/aarch64-poe-core.exp   | 101 ++++++++++++++++++
 gdb/testsuite/gdb.arch/aarch64-poe-sigsegv.   |   0
 gdb/testsuite/gdb.arch/aarch64-poe-sigsegv.c  |  52 +++++++++
 .../gdb.arch/aarch64-poe-sigsegv.exp          |  58 ++++++++++
 gdb/testsuite/gdb.arch/aarch64-poe.c          |  29 +++++
 gdb/testsuite/gdb.arch/aarch64-poe.exp        |  46 ++++++++
 gdb/testsuite/lib/gdb.exp                     |  55 ++++++++++
 gdbserver/linux-aarch64-low.cc                |  30 ++++++
 20 files changed, 723 insertions(+), 4 deletions(-)
 create mode 100644 gdb/arch/aarch64-poe-linux.h
 create mode 100644 gdb/features/aarch64-poe.c
 create mode 100644 gdb/features/aarch64-poe.xml
 create mode 100644 gdb/nat/aarch64-poe-linux.h
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-poe-core.exp
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-poe-sigsegv.
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-poe-sigsegv.c
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-poe-sigsegv.exp
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-poe.c
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-poe.exp

-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.