|
|
Log in / Subscribe / Register

Add test for atomic uaccess with permission overlay

From:  Kevin Brodsky <kevin.brodsky-AT-arm.com>
To:  linux-arm-kernel-AT-lists.infradead.org
Subject:  [PATCH 0/2] Add test for atomic uaccess with permission overlay
Date:  Thu, 21 May 2026 10:42:29 +0100
Message-ID:  <20260521-poe_futex-v1-0-1da286b8f9b2@arm.com>
Cc:  Kevin Brodsky <kevin.brodsky-AT-arm.com>, Catalin Marinas <catalin.marinas-AT-arm.com>, Joey Gouly <joey.gouly-AT-arm.com>, Mark Brown <broonie-AT-kernel.org>, Shuah Khan <shuah-AT-kernel.org>, Will Deacon <will-AT-kernel.org>, linux-kernel-AT-vger.kernel.org, linux-kselftest-AT-vger.kernel.org
Archive-link:  Article

Permission overlays are not currently applied for memory types
configured in PIR_EL1, meaning that even if POE were enabled at EL1,
memory accesses would not be subject to POE restrictions.

A patch [1] in my series adding page table protection using
pkeys/POE [2] enabled overlays for all memory types in PIR_EL1. It
turns out this is wrong, as reported by Sashiko [3]. User memory
types must not have overlays applied in PIR_EL1, otherwise direct
accesses to user memory with privileged loads/stores (and PAN
disabled) will mistakenly be checked against POR_EL1, instead of the
intended POR_EL0.

To avoid any accident in the future, this series adds a comment
above the PIR_EL1 configuration block, and a kselftest to ensure
that atomic futex uaccess (which uses privileged loads/stores unless
FEAT_LSUI is available) does work on memory mapped with a
non-default pkey. 

Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>

[1] https://lore.kernel.org/all/20260505-kpkeys-v7-3-20c0bdd9...
[2] https://lore.kernel.org/all/20260505-kpkeys-v7-0-20c0bdd9...
[3] https://sashiko.dev/#/patchset/20260505-kpkeys-v7-0-20c0b...

---
To: linux-arm-kernel@lists.infradead.org
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Joey Gouly <joey.gouly@arm.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Will Deacon <will@kernel.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-kselftest@vger.kernel.org

---
Kevin Brodsky (2):
      arm64: mm: Add note about overlays in PIE_EL1
      kselftest/arm64: Add test for atomic futex uaccess with POE

 arch/arm64/include/asm/pgtable-prot.h         |  7 +++
 tools/testing/selftests/arm64/Makefile        |  2 +-
 tools/testing/selftests/arm64/poe/.gitignore  |  2 +
 tools/testing/selftests/arm64/poe/Makefile    |  6 +++
 tools/testing/selftests/arm64/poe/poe_futex.c | 62 +++++++++++++++++++++++++++
 5 files changed, 78 insertions(+), 1 deletion(-)
---
base-commit: 5200f5f493f79f14bbdc349e402a40dfb32f23c8
change-id: 20260520-poe_futex-ecb8c2276894




Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds