Linux Kernel Selftest development
 help / color / mirror / Atom feed
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 v3 1/2] futex: Canonicalize arm64 tagged user addresses
Date: Thu, 12 Nov 2026 17:34:32 +0000	[thread overview]
Message-ID: <avX4qJ9SG3SJynen@arm.com> (raw)
In-Reply-To: <20261109-futex-tagged-uaddr-v2-prep-v3-1-3f5f2ef83138@gentwo.org>

On Mon, Nov 09, 2026 at 10:26:47AM -0800, 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.
> 
> 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>
> Acked-by: Davidlohr Bueso <dave@stgolabs.net>
> Signed-off-by: Shubhang Kaushik (Ampere) <sh@gentwo.org>
> ---
>  kernel/futex/core.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/kernel/futex/core.c b/kernel/futex/core.c
> index a240638f69e5c65bd036434a15f3df680efb4638..dcc8ffca38595a5ea69f3672375ffb9f9c6766f9 100644
> --- a/kernel/futex/core.c
> +++ b/kernel/futex/core.c
> @@ -539,6 +539,8 @@ int get_futex_key(u32 __user *uaddr, unsigned int flags, union futex_key *key,
>  	if (unlikely(!access_ok(uaddr, size)))
>  		return -EFAULT;
>  
> +	address = untagged_addr(address);
> +
>  	if (unlikely(should_fail_futex(fshared)))
>  		return -EFAULT;

Thomas, Peter, do you plan to take this fix via tip or you'd rather we
take it via arm64? TBH, I don't think it's urgent, the bug has been
around since 2019.

Thanks.

-- 
Catalin

  reply	other threads:[~2026-11-12 17:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 18:26 [PATCH v3 0/2] futex: Canonicalize arm64 tagged user addresses Shubhang Kaushik (Ampere)
2026-11-09 18:26 ` [PATCH v3 1/2] " Shubhang Kaushik (Ampere)
2026-11-12 17:34   ` Catalin Marinas [this message]
2026-11-09 18:26 ` [PATCH v3 2/2] selftests/futex: Test tagged arm64 futex addresses Shubhang Kaushik (Ampere)

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=avX4qJ9SG3SJynen@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