Re: [PATCH v1] gdb/linux-tdep: display ProtectionKey in info proc mappings

Matthieu Longo <[email protected]> Tue, 28 Jul 2026 16:30:59 +0100
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
On 28/07/2026 16:29, Matthieu Longo wrote:
> Memory Protection Keys provide a mechanism for enforcing page-based
> protections without requiring modification of the page tables
> when an application changes protection domains. [1]
> 
> The "ProtectionKey" field may be present in /proc/PID/smaps on x86_64,
> PowerPC, and AArch64 systems since Linux 4.9, when the kernel is built
> with Memory Protection Keys support.
> 
> Store the parsed PKey in smaps_data as an optional value on systems
> where the kernel reports memory protection keys.
> 
> Parse /proc/PID/smaps alongside /proc/PID/maps when printing 'info
> proc mappings', and add a PKey column when at least one smaps entry
> contains a "ProtectionKey" field.
> This lets 'info proc mappings' show the protection key associated with
> each mapped address range.
> 
> [1]: https://docs.kernel.org/core-api/protection-keys.html,
>      https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/
>      linux.git/commit/?id=c1192f842841
> ---
Please, note that this patch has a dependency on the new class file_reader_t introduced in
https://inbox.sourceware.org/gdb-patches/[email protected]/

Matthieu