public inbox for linux-api@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] futex: how to solve the robust_list race condition?
@ 2026-02-20 20:26 André Almeida
  2026-02-20 20:26 ` [RFC PATCH 1/2] futex: Create reproducer for robust_list race condition André Almeida
                   ` (3 more replies)
  0 siblings, 4 replies; 23+ messages in thread
From: André Almeida @ 2026-02-20 20:26 UTC (permalink / raw)
  To: Carlos O'Donell, Sebastian Andrzej Siewior, Peter Zijlstra,
	Florian Weimer, Rich Felker, Torvald Riegel, Darren Hart,
	Thomas Gleixner, Ingo Molnar, Davidlohr Bueso, Arnd Bergmann,
	Mathieu Desnoyers, Liam R . Howlett
  Cc: kernel-dev, linux-api, linux-kernel, André Almeida

During LPC 2025, I presented a session about creating a new syscall for
robust_list[0][1]. However, most of the session discussion wasn't much related
to the new syscall itself, but much more related to an old bug that exists in
the current robust_list mechanism.

Since at least 2012, there's an open bug reporting a race condition, as
Carlos O'Donell pointed out:

  "File corruption race condition in robust mutex unlocking"
  https://sourceware.org/bugzilla/show_bug.cgi?id=14485

To help understand the bug, I've created a reproducer (patch 1/2) and a
companion kernel hack (patch 2/2) that helps to make the race condition
more likely. When the bug happens, the reproducer shows a message
comparing the original memory with the corrupted one:

  "Memory was corrupted by the kernel: 8001fe8d8001fe8d vs 8001fe8dc0000000"

I'm not sure yet what would be the appropriated approach to fix it, so I
decided to reach the community before moving forward in some direction.
One suggestion from Peter[2] resolves around serializing the mmap() and the
robust list exit path, which might cause overheads for the common case,
where list_op_pending is empty.

However, giving that there's a new interface being prepared, this could
also give the opportunity to rethink how list_op_pending works, and get
rid of the race condition by design.

Feedback is very much welcome.

Thanks!
	André

[0] https://lore.kernel.org/lkml/20251122-tonyk-robust_futex-v6-0-05fea005a0fd@igalia.com/
[1] https://lpc.events/event/19/contributions/2108/
[2] https://lore.kernel.org/lkml/20241219171344.GA26279@noisy.programming.kicks-ass.net/

André Almeida (2):
  futex: Create reproducer for robust_list race condition
  futex: Add debug delays

 kernel/futex/core.c |  10 +++
 robust_bug.c        | 178 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 188 insertions(+)
 create mode 100644 robust_bug.c

-- 
2.53.0


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2026-03-12 13:37 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-20 20:26 [RFC PATCH 0/2] futex: how to solve the robust_list race condition? André Almeida
2026-02-20 20:26 ` [RFC PATCH 1/2] futex: Create reproducer for robust_list race condition André Almeida
2026-03-12  9:04   ` Sebastian Andrzej Siewior
2026-03-12 13:36     ` André Almeida
2026-02-20 20:26 ` [RFC PATCH 2/2] futex: hack: Add debug delays André Almeida
2026-02-20 20:51 ` [RFC PATCH 0/2] futex: how to solve the robust_list race condition? Liam R. Howlett
2026-02-27 19:15   ` André Almeida
2026-02-20 21:42 ` Mathieu Desnoyers
2026-02-20 22:41   ` Mathieu Desnoyers
2026-02-20 23:17     ` Mathieu Desnoyers
2026-02-23 11:13       ` Florian Weimer
2026-02-23 13:37         ` Mathieu Desnoyers
2026-02-23 13:47           ` Rich Felker
2026-02-27 19:16       ` André Almeida
2026-02-27 19:59         ` Mathieu Desnoyers
2026-02-27 20:41           ` Suren Baghdasaryan
2026-03-01 15:49           ` Mathieu Desnoyers
2026-03-02  7:31             ` Florian Weimer
2026-03-02 14:57               ` Mathieu Desnoyers
2026-03-02 15:32                 ` Florian Weimer
2026-03-02 16:32                   ` Mathieu Desnoyers
2026-03-02 16:42                     ` Florian Weimer
2026-03-02 16:56                       ` Mathieu Desnoyers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox