[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250612121817.1621-1-dakr@kernel.org>
Date: Thu, 12 Jun 2025 14:17:12 +0200
From: Danilo Krummrich <dakr@...nel.org>
To: gregkh@...uxfoundation.org,
rafael@...nel.org,
ojeda@...nel.org,
alex.gaynor@...il.com,
boqun.feng@...il.com,
gary@...yguo.net,
bjorn3_gh@...tonmail.com,
benno.lossin@...ton.me,
a.hindborg@...nel.org,
aliceryhl@...gle.com,
tmgross@...ch.edu
Cc: rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org,
Danilo Krummrich <dakr@...nel.org>
Subject: [PATCH v2 0/3] Fix race condition in Devres
This patch series fixes a race condition in Devres.
Please see patch 3 "rust: devres: fix race in Devres::drop()" for a detailed
description of the race and how it is fixed.
None of the upstream users of Devres is prone to this race, hence we do not
necessarily have to backport this -- yet, it must be fixed.
Thanks to Alice for catching and reporting this!
A branch containing those patches can be found in [1].
[1] https://git.kernel.org/pub/scm/linux/kernel/git/dakr/linux.git/log/?h=rust/devres-race
Changes in v2:
- Completion
- s/can queue themselves up/have been queued up/
- move up Send / Sync impl
- refer to complete_all() from wait_for_completion()
- clarify "permanentely done" with "i.e. signals all current and future
waiters"
- Devres
- pick more appropriate 'Fixes' tag
- extend commit message with an illustration of the race
Danilo Krummrich (3):
rust: completion: implement initial abstraction
rust: revocable: indicate whether `data` has been revoked already
rust: devres: fix race in Devres::drop()
rust/bindings/bindings_helper.h | 1 +
rust/helpers/completion.c | 8 +++
rust/helpers/helpers.c | 1 +
rust/kernel/devres.rs | 33 ++++++++--
rust/kernel/revocable.rs | 18 +++--
rust/kernel/sync.rs | 2 +
rust/kernel/sync/completion.rs | 112 ++++++++++++++++++++++++++++++++
7 files changed, 164 insertions(+), 11 deletions(-)
create mode 100644 rust/helpers/completion.c
create mode 100644 rust/kernel/sync/completion.rs
base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
--
2.49.0
Powered by blists - more mailing lists