From: Danilo Krummrich <dakr@kernel.org>
To: gregkh@linuxfoundation.org, rafael@kernel.org, ojeda@kernel.org,
alex.gaynor@gmail.com, boqun.feng@gmail.com, gary@garyguo.net,
bjorn3_gh@protonmail.com, benno.lossin@proton.me,
a.hindborg@kernel.org, aliceryhl@google.com, tmgross@umich.edu
Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
Danilo Krummrich <dakr@kernel.org>
Subject: [PATCH v2 0/3] Fix race condition in Devres
Date: Thu, 12 Jun 2025 14:17:12 +0200 [thread overview]
Message-ID: <20250612121817.1621-1-dakr@kernel.org> (raw)
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
next reply other threads:[~2025-06-12 12:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-12 12:17 Danilo Krummrich [this message]
2025-06-12 12:17 ` [PATCH v2 1/3] rust: completion: implement initial abstraction Danilo Krummrich
2025-06-13 15:51 ` Miguel Ojeda
2025-06-12 12:17 ` [PATCH v2 2/3] rust: revocable: indicate whether `data` has been revoked already Danilo Krummrich
2025-06-13 15:53 ` Miguel Ojeda
2025-06-12 12:17 ` [PATCH v2 3/3] rust: devres: fix race in Devres::drop() Danilo Krummrich
2025-06-12 13:07 ` Benno Lossin
2025-06-13 22:05 ` [PATCH v2 0/3] Fix race condition in Devres Danilo Krummrich
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=20250612121817.1621-1-dakr@kernel.org \
--to=dakr@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=rafael@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/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®