[PATCH v6 0/2] aarch64: Add support for memory protection keys

Yury Khrustalev yury.khrustalev@arm.com
Fri Nov 1 12:17:07 GMT 2024


We add support for memory protection keys on AArch64 systems with enabled Stage 1
permission overlays feature introduced in Armv8.9 / 9.4 (FEAT_S1POE) [1] and update
Glibc manual accordingly.

Since I've added changes to the generic test "misc/tst-pkey" that runs on several
targets, I've tested this change on aarch64-linux-gnu and x86_64-linux-gnu using
native build and on the following targets using cross-build (build-many-glibcs.py):
 - aarch64_be-linux-gnu
 - arm-linux-gnueabi
 - armeb-linux-gnueabi
 - arm-linux-gnueabihf
 - armeb-linux-gnueabihf
 - powerpc-linux-gnu
 - powerpc64-linux-gnu
and no regressions have been found.

Corresponding Linux change: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git v6.12-rc5
Starting with commit bf83dae90fbc01d66477a3440eaad07da6657fdc.

FVP model provided by the Shrinkwrap tool [2] can be used for testing.

OK for trunk?

Changes in v6:
 - Fixes for comments in [3]
 - Split documentation change into separate commit
 - Note that documentation changes that are not directly related to the new AArch64
   specific pkey flags are done in independent patch series [4]
 - v5: https://inbox.sourceware.org/libc-alpha/20241011153614.3189334-1-yury.khrustalev@arm.com/

Changes in v5:
 - Added Added ISB instruction after MSR for POR_EL0 register in pkey_write()
 - v4: https://inbox.sourceware.org/libc-alpha/20241010125541.354067-1-yury.khrustalev@arm.com/

Changes in v4:
 - Updated documentation for pkey_set and pkey_get
 - The rights argument in the pkey_alloc() and pkey_set() renamed to restrictions
 - Some of the PKEY_* flags combinations were resulting in error, fixed now
 - Fixed code style issues as per [5]
 - v3: https://inbox.sourceware.org/libc-alpha/20240926121315.20096-1-yury.khrustalev@arm.com/

[1] https://developer.arm.com/documentation/ddi0487/ka/ section D8.4.1.4
[2] https://git.gitlab.arm.com/tooling/shrinkwrap.git
[3] https://inbox.sourceware.org/libc-alpha/47f9d649-5c31-4a53-8b6e-3fb54e62809a@linaro.org/
[4] https://inbox.sourceware.org/libc-alpha/20241101100223.1019242-1-yury.khrustalev@arm.com/
[5] https://inbox.sourceware.org/libc-alpha/e62999fe-83c2-4954-b6d5-6b0e4fd9d405@linaro.org/

---

Yury Khrustalev (2):
  aarch64: Add support for memory protection keys
  manual: Add description of AArch64-specific pkey flags

 manual/memory.texi                            |  16 +-
 sysdeps/unix/sysv/linux/aarch64/Makefile      |   3 +
 sysdeps/unix/sysv/linux/aarch64/arch-pkey.h   |  53 +++++
 sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h  |   1 +
 sysdeps/unix/sysv/linux/aarch64/bits/mman.h   |   8 +
 sysdeps/unix/sysv/linux/aarch64/pkey_get.c    |  73 +++++++
 sysdeps/unix/sysv/linux/aarch64/pkey_set.c    | 113 +++++++++++
 .../sysv/linux/aarch64/tst-aarch64-pkey.c     | 185 ++++++++++++++++++
 sysdeps/unix/sysv/linux/tst-pkey.c            |  51 +++--
 9 files changed, 491 insertions(+), 12 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/arch-pkey.h
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/pkey_get.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/pkey_set.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-aarch64-pkey.c

-- 
2.39.5



More information about the Libc-alpha mailing list