Re: [PATCH v1 09/10] gdb/linux-tdep: parse ProtectionKey in /proc/PID/smaps
Matthieu Longo <[email protected]>
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Message-ID | <[email protected]> |
On 14/07/2026 10:12, Matthieu Longo wrote:
> On 09/07/2026 07:42, Thiago Jung Bauermann wrote:
>>
>> There's nothing in this patch series that uses the parsed pkey, so IMHO
>> (other maintainers may disagree) it makes more sense if this patch is
>> committed together with a patch that makes use of the field.
>>
>
> Nothing uses it yet because it is still unclear how to expose it to the users.
> I assume that "info proc mappings" is a good place to do it.
>
> As a reminder those are the existing columns:
> Start Addr End Addr Size Offset Perms File
>
> Should we add a new column "Protection Key" or "PKey" between "Offset" and "Perms" ?
> What do you think ?
>
Additionally, if we were to print the permissions associated with a PKey, what do you think about
the following view ?
Start Addr End Addr Size Offset PKey Perms File
0x0000000000400000 0x0000000000483000 0x83000 0x0 0 r-xp /path/to/file
...
0x00000000004a2000 0x00000000004a7000 0x5000 0x0 1 rw-p
Thread 1: effective: r-- overlay: r--
Thread 3: effective: rw- overlay: rw-
Thread 4: effective: r-- overlay: r-x
Effective being the effective permissions resulting from the ANDing of the base permissions (coming
from "Perms") AND the overlay permissions attached to a thread (permissions associated to the PKey.
The look-up of those overlay permissions is platform-specific).
If no protection key support exists on the target, the PKey column would not be printed.
Same for the threads' permissions (effective and overlay).
Does this approach look fine to you ? Does it overload the view ?
Should the dumping of effective and overlay permissions be part of a generic or platform-specific
command ?
Matthieu