rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Fix race condition in Devres
@ 2025-06-12 12:17 Danilo Krummrich
  2025-06-12 12:17 ` [PATCH v2 1/3] rust: completion: implement initial abstraction Danilo Krummrich
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Danilo Krummrich @ 2025-06-12 12:17 UTC (permalink / raw)
  To: gregkh, rafael, ojeda, alex.gaynor, boqun.feng, gary, bjorn3_gh,
	benno.lossin, a.hindborg, aliceryhl, tmgross
  Cc: rust-for-linux, linux-kernel, Danilo Krummrich

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


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

end of thread, other threads:[~2025-06-13 22:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-12 12:17 [PATCH v2 0/3] Fix race condition in Devres Danilo Krummrich
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).