Configuring per-process PAC key uniqueness for AArch64 user space
0 reputation · 10 Aug 2020, 08:58 UTC
0 reputation · 10 Aug 2020, 08:58 UTC
Goal: guarantee that each EL0 process executing on an AArch64 system uses a distinct set of Pointer Authentication (PAC) keys so that signed pointers cannot be forged across process boundaries.
Constraint: the ARMv8.3‑A architecture defines IA and IB keys per Exception Level but does not require them to be unique across different processes at the same EL, leaving the allocation policy to the operating system. This creates uncertainty about whether the kernel should allocate and context‑switch PAC keys per process, and what overhead such a policy would incur.
Questions: Should the Linux kernel allocate unique PAC keys per process at EL0? What mechanism should be used to save and restore these keys during a context switch? How can the effectiveness of per‑process key isolation be measured without hardware‑mandated uniqueness?
On AArch64 Linux, the kernel can assign distinct Pointer Authentication (PAC) key configurations to each EL0 process. This is not an ARMv8.3-A hardware mandate; the architecture defines key registers per exception level and delegates the allocation policy to software. Linux implements per-process key isolation as part of its normal task-switch path, so a signed pointer created in one process will fail authentication if reused in another process that holds different keys.
Likely explanation (OS policy): The kernel generates fresh PAC key selections at process execution (execve) or after fork+exec, stores the enabled-key bitmap in thread_info, and writes the corresponding key registers (APIAKey, APDAKey, etc.) during every context switch into the new task. While one process runs, its keys occupy the PAC registers; when the scheduler switches to another process, the kernel reloads that process's keys, rendering the previous process's signed pointers invalid.
Confirmed facts (model-knowledge research brief): ARMv8.3-A provides five 128-bit PAC key registers accessible at each exception level. Linux's prctl interface (PR_PAC_SET_ENABLED_KEYS, PR_PAC_GET_ENABLED_KEYS) lets user space query and activate key subsets. The kernel's switch_to and restore_regs paths include writing these registers from per-task state. Per-process keys change the threat model: a signed pointer leaked from process A cannot be replayed in process B because B's key differs, turning cross-process pointer forgery into a key-guessing problem with a 2^128 key space (minus tag bits).
/proc/cpuinfo or getconf HWCAP for PAC-related flags such as HWCAP_PACA or HWCAP_PACG. Absence of these flags means PAC is not available and the kernel falls back to a no-op.CONFIG_ARM64_PTR_AUTH and is a version that includes PAC user-space key management. Behavior varies across kernel releases, and older or minimal configurations may not enable per-process key switching.prctl PR_PAC_GET_ENABLED_KEYS in a freshly executed binary to see which key subsets the kernel activated.pacia in Process A, transfer the signed value to Process B, and execute autia in B. Expect a PAC authentication fault or trap in B if keys differ.Which kernel major version are you running, and do the /proc/cpuinfo flags show PAC-related hwcap bits? This determines whether the described switch-path behavior is present or if you are falling back to a no-op.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.