[lldb][AArch64][Linux] Add support for the Permission Overlay Extension (POE) (#177145)
This change adds initial support for managing the Permission Overlay
Extension (POE). This extension allows userspace programs to change
memory permissions without making a sycall.
This is used to implement Linux's memory protection keys
(https://docs.kernel.org/core-api/protection-keys.html) on AArch64.
Overview of POE:
* Page table entries have a set of permissions. To change these, a
program would have to use a syscall which adds overhead.
* 3 bits of the page table entry are used for a protection key 0-7.
* POE adds a new register "por" (POR_EL0 in the manual) which stores
4-bit sets of permissions.
* The protection key is an index into this por register.
* Permissions in POR are applied on top of the page table permissions,
but may only remove permissions. For example, if you overlay
read/execute over read/write, the result is read. Since execute was not
in the page table permissions.
* This register can be modified without leaving userspace, making
permission changes faster.
To help debug this, I have made the following changes to LLDB:
* Ability to read and write the por register.
* Save and restore of por when running expressions.
* Register field definitions to print the por permissions in a human
readable form.
* Recognition of memory protection key faults as a distinct type of
SIGSEGV (this will apply to Linux on any architecture).
There are a few more features to add around memory region information,
that will be in follow up changes. As will documentation and release
notes for all the POE features.