From: Catalin Marinas <catalin.marinas@arm.com>
To: "Shubhang Kaushik (Ampere)" <sh@gentwo.org>
Cc: "Thomas Gleixner" <tglx@kernel.org>,
"Ingo Molnar" <mingo@redhat.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Darren Hart" <dvhart@infradead.org>,
"Davidlohr Bueso" <dave@stgolabs.net>,
"André Almeida" <andrealmeid@igalia.com>,
"Shuah Khan" <shuah@kernel.org>, "Kees Cook" <kees@kernel.org>,
"Shubhang Kaushik" <shubhang@os.amperecomputing.com>,
"Christoph Lameter (Ampere)" <cl@gentwo.org>,
"Andrey Konovalov" <andreyknvl@gmail.com>,
"Will Deacon" <will@kernel.org>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v2] futex: Canonicalize arm64 tagged user addresses
Date: Thu, 5 Nov 2026 10:53:40 +0000 [thread overview]
Message-ID: <auxgNACRQVqTuqd3@arm.com> (raw)
In-Reply-To: <20261030-futex-tagged-uaddr-v2-prep-v2-1-131eb7414bda@gentwo.org>
On Fri, Oct 30, 2026 at 03:39:59PM -0700, Shubhang Kaushik (Ampere) wrote:
> On arm64, a thread that enables the tagged address ABI can pass valid
> top-byte-tagged user pointers to futex syscalls. Such a pointer must
> have the same syscall behaviour as its untagged form.
>
> get_futex_key() validates the user address with access_ok(), but uses
> the raw address when constructing private and shared-anonymous futex
> keys. A waiter using a tagged address and a waker using the untagged
> form can therefore access the same futex word while hashing to distinct
> keys, causing FUTEX_WAKE to miss the waiter.
>
> Keep access_ok() on the original pointer so that arm64 retains its
> per-thread tagged-address ABI enforcement. Canonicalize the address
> afterwards, before it is used for futex key construction and shared
> mapping lookup.
>
> Add an arm64 64-bit selftest for a tagged private waiter woken through
> the corresponding untagged address.
>
> Fixes: 63f0c6037965 ("arm64: Introduce prctl() options to control the tagged user addresses ABI")
> Cc: stable@vger.kernel.org
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
> Signed-off-by: Shubhang Kaushik (Ampere) <sh@gentwo.org>
> ---
> Changes in v2:
> - Add the generated tagged-address test binary to .gitignore.
> - Compile the arm64-specific test implementation only for arm64 64-bit
> builds.
> - Avoid relying on /proc/<tid>/wchan to detect that the waiter has
> queued; retry the untagged wake for a bounded interval instead.
>
> Link to v1: https://lore.kernel.org/r/20261022-futex-arm64-tagged-uaddr-v1-1-84d8afbe7668@gentwo.org
> ---
> kernel/futex/core.c | 2 +
> .../testing/selftests/futex/functional/.gitignore | 1 +
> tools/testing/selftests/futex/functional/Makefile | 1 +
> .../selftests/futex/functional/futex_tagged_addr.c | 61 ++++++++++++++++++++++
> tools/testing/selftests/futex/functional/run.sh | 3 ++
> 5 files changed, 68 insertions(+)
Since this is a cc stable, I'd separate the actual fix from the
kselftest with the latter not cc'ed to stable.
Thanks.
--
Catalin
next prev parent reply other threads:[~2026-11-05 10:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 22:39 Shubhang Kaushik (Ampere)
2026-11-05 10:53 ` Catalin Marinas [this message]
2026-11-05 16:20 ` Davidlohr Bueso
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=auxgNACRQVqTuqd3@arm.com \
--to=catalin.marinas@arm.com \
--cc=andrealmeid@igalia.com \
--cc=andreyknvl@gmail.com \
--cc=cl@gentwo.org \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=sh@gentwo.org \
--cc=shuah@kernel.org \
--cc=shubhang@os.amperecomputing.com \
--cc=stable@vger.kernel.org \
--cc=tglx@kernel.org \
--cc=will@kernel.org \
/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
all inboxes | Powered by JetHome®