Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Brodsky <kevin.brodsky@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Joey Gouly <joey.gouly@arm.com>,
	Linu Cherian <linu.cherian@arm.com>,
	Mark Brown <broonie@kernel.org>, Shuah Khan <shuah@kernel.org>,
	Will Deacon <will@kernel.org>, Yeoreum Yun <yeoreum.yun@arm.com>,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v2 0/2] Add test for atomic uaccess with permission overlay
Date: Thu, 19 Nov 2026 11:38:27 +0100	[thread overview]
Message-ID: <243812f7-3883-4225-8f46-aa2a5face413@arm.com> (raw)
In-Reply-To: <20261119-poe_futex-v2-0-244c7a01f788@arm.com>

On 19/11/2026 10:54, Kevin Brodsky wrote:
> POE is not currently enabled at EL1, but my series [1] protecting
> page tables does exactly that, and it has revealed an interesting
> issue.
>
> Regular uaccess uses unprivileged loads/stores, which have overlays
> applied and are checked against the user's POR_EL0 as intended (same
> restrictions as when accessing memory from userspace). In some
> cases, such as atomic operations when FEAT_LSUI isn't available, we
> need to use privileged L/S with PAN disabled instead; overlays are
> not applied in that case.
>
> Once POE is enabled at EL1, we have to ensure that overlays are
> still not applied to these accesses. Otherwise, they will be checked
> against POR_EL1, which is completely invalid as kernel
> pkeys/POIndices are unrelated to user pkeys.
>
> If PIE is used, then we have to ensure that user memory types do not
> have overlays applied in POR_EL1, as Sashiko reported [2] on an
> earlier version of my series protecting page tables. Patch 1 tries
> to preempt such errors by adding a comment. If PIE isn't available,
> then... we're out of luck, as Sashiko reported later on [3]: we
> cannot prevent overlays from being applied to user memory. We'll
> most likely have to require PIE at least when POE is enabled at
> EL1.
>
> To avoid accidents in the future, patch 2 adds 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/r/20261109-kpkeys-v10-0-aa6c4d9603bc@arm.com
> [2] https://sashiko.dev/#/patchset/20260505-kpkeys-v7-0-20c0bdd97197%40arm.com?part=3
> [3] https://lore.kernel.org/r/sashiko-outbox-207324@kernel.org
>
> ---
> v1..v2:
>
> * Reworded the cover letter and the commit message of patch 2 in
>   light of Sashiko's new findings (when PIE isn't available).
> * Rebased on v7.4-rc3
>
> v1: https://lore.kernel.org/all/20260521-poe_futex-v1-0-1da286b8f9b2@arm.com/
>
> ---
> To: linux-arm-kernel@lists.infradead.org
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Joey Gouly <joey.gouly@arm.com>
> Cc: Linu Cherian <linu.cherian@arm.com>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Shuah Khan <shuah@kernel.org>
> Cc: Will Deacon <will@kernel.org>
> Cc: Yeoreum Yun <yeoreum.yun@arm.com>
> 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

I completely forgot to address Mark's comment from v1... Please ignore
this for now, sending a v3 soon.

- Kevin


      parent reply	other threads:[~2026-11-19 10:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  9:54 [PATCH v2 0/2] Add test for atomic uaccess with permission overlay Kevin Brodsky
2026-11-19  9:54 ` [PATCH v2 1/2] arm64: mm: Add note about overlays in PIE_EL1 Kevin Brodsky
2026-11-19 10:14   ` Yeoreum Yun
2026-11-19  9:54 ` [PATCH v2 2/2] kselftest/arm64: Add test for atomic futex uaccess with POE Kevin Brodsky
2026-11-19 10:35   ` Yeoreum Yun
2026-11-19 10:38 ` Kevin Brodsky [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=243812f7-3883-4225-8f46-aa2a5face413@arm.com \
    --to=kevin.brodsky@arm.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=joey.gouly@arm.com \
    --cc=linu.cherian@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=will@kernel.org \
    --cc=yeoreum.yun@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox