From: Gabriel Ravier <gabravier@gmail.com>
To: libc-coord@lists.openwall.com,
"André Almeida" <andrealmeid@igalia.com>,
"Ingo Molnar" <mingo@redhat.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Darren Hart" <dvhart@infradead.org>,
"Davidlohr Bueso" <dave@stgolabs.net>,
"Arnd Bergmann" <arnd@arndb.de>,
"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
"Waiman Long" <longman@redhat.com>,
"Ryan Houdek" <Sonicadvance1@gmail.com>,
"Florian Weimer" <fweimer@redhat.com>,
"Thomas Gleixner" <tglx@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-api@vger.kernel.org, kernel-dev@igalia.com
Subject: Re: [libc-coord] [PATCH v9 04/14] futex: Introduce futex_get_robust_lists() and futex_sched_data::robust_lists
Date: Sun, 6 Dec 2026 16:42:52 +0100 [thread overview]
Message-ID: <4af6f568-77b5-4c6d-9189-c20871bcaf58@gmail.com> (raw)
In-Reply-To: <20261204-tonyk-robust_futex-v9-4-743d68d488b5@igalia.com>
On 12/4/26 5:15 PM, André Almeida wrote:
> Add a new field robust_lists to struct futex_sched_data. This field stores
> a pointer to an array of robust list head pointers, to support multi-lists
> per task.
>
> Create futex_get_robust_lists() to get the robust_lists pointer. If the
> list is not yet allocated, try to allocate it. The caller is responsible
> for checking if the allocation failed and if it's a NULL pointer.
> Allocation is race free giving that this is a per-task data, allocated from
given that :)
> syscall context.
>
> futex_sched_data::robust_lists has two reserved indexes:
> `FUTEX_ROBUST_LIST2_NATIVE_IDX` to store the robust list head pointer for
> the current syscall set_robust_list() and `FUTEX_ROBUST_LIST2_COMPAT_IDX`
> for the compat entry point head pointer. Those elements will be used to
> replace futex_sched_data::{robust_list, robust_list32}.
>
> futex_sched_data::robust_lists will be freed in a following commit.
>
> Signed-off-by: André Almeida <andrealmeid@igalia.com>
> ---
> include/linux/futex.h | 1 +
> include/linux/futex_types.h | 2 ++
> kernel/futex/core.c | 12 ++++++++++++
> kernel/futex/futex.h | 8 ++++++++
> 4 files changed, 23 insertions(+)
>
> [...]
>
> diff --git a/kernel/futex/core.c b/kernel/futex/core.c
> index bcfa59168911..dc5b6379060e 100644
> --- a/kernel/futex/core.c
> +++ b/kernel/futex/core.c
> @@ -1124,6 +1124,18 @@ static int handle_futex_death(u32 __user *uaddr, struct task_struct *curr,
> return 0;
> }
>
> +uintptr_t *futex_get_robust_lists(void)
> +{
> + uintptr_t *rl = current->futex.robust_lists;
> +
> + if (!rl) {
> + rl = kcalloc(FUTEX_ROBUST_LIST2_MAX_IDX, sizeof(*rl), GFP_KERNEL);
> + current->futex.robust_lists = rl;
Weak-ordering architectures like AArch64 or POWER (from another CPU's
get_robust_list, starting on patch 6) can see this pointer before the
zeroing stores, so thus can leak the stale heap contents (from before
kcalloc's stores) straight to userspace.
> + }
> +
> + return rl;
> +}
> +
> /*
> * Fetch a robust-list pointer. Bit 0 signals PI futexes:
> */
>
> [...]
next prev parent reply other threads:[~2026-12-06 15:42 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 16:15 [PATCH v9 00/14] futex: Create {set,get}_robust_list2() syscalls André Almeida
2026-12-04 16:15 ` [PATCH v9 01/14] futex: Use explicit sizes for compat_robust_list structs André Almeida
2026-12-04 16:15 ` [PATCH v9 02/14] futex: Make exit_robust_list32() unconditionally available for 64-bit kernels André Almeida
2026-12-04 16:15 ` [PATCH v9 03/14] futex: Give a specific head pointer to exit_robust_list() André Almeida
2026-12-04 16:15 ` [PATCH v9 04/14] futex: Introduce futex_get_robust_lists() and futex_sched_data::robust_lists André Almeida
2026-12-06 15:42 ` Gabriel Ravier [this message]
2026-12-04 16:15 ` [PATCH v9 05/14] futex: Create exit_robust_lists() for multi-robust list André Almeida
2026-12-05 9:55 ` kernel test robot
2026-12-04 16:15 ` [PATCH v9 06/14] futex: Use the multi-robust list infrastructure for current syscalls André Almeida
2026-12-06 15:18 ` [libc-coord] " Gabriel Ravier
2026-12-06 15:45 ` Gabriel Ravier
2026-12-04 16:15 ` [PATCH v9 07/14] futex: Expose robust_list2 limits via sysctl André Almeida
2026-12-04 16:15 ` [PATCH v9 08/14] futex: Create syscall set_robust_list2() André Almeida
2026-12-06 15:47 ` [libc-coord] " Gabriel Ravier
2026-12-04 16:15 ` [PATCH v9 09/14] futex: Make futex_task_robust_list() get list by index André Almeida
2026-12-04 16:15 ` [PATCH v9 10/14] futex: Create get_robust_list2() syscall André Almeida
2026-12-04 16:15 ` [PATCH v9 11/14] futex: Wire up set_robust_list2 syscall André Almeida
2026-12-05 9:55 ` kernel test robot
2026-12-05 9:55 ` kernel test robot
2026-12-04 16:15 ` [PATCH v9 12/14] futex: Wire up get_robust_list2 syscall André Almeida
2026-12-04 16:15 ` [PATCH v9 13/14] selftests/futex: Expand for set_robust_list2() André Almeida
2026-12-06 16:03 ` [libc-coord] " Gabriel Ravier
2026-12-04 16:15 ` [PATCH v9 14/14] selftests/futex: Expand for get_robust_list2() André Almeida
2026-12-06 16:06 ` [libc-coord] " Gabriel Ravier
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=4af6f568-77b5-4c6d-9189-c20871bcaf58@gmail.com \
--to=gabravier@gmail.com \
--cc=Sonicadvance1@gmail.com \
--cc=andrealmeid@igalia.com \
--cc=arnd@arndb.de \
--cc=bigeasy@linutronix.de \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=fweimer@redhat.com \
--cc=kernel-dev@igalia.com \
--cc=libc-coord@lists.openwall.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@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