Rust for Linux List
 help / color / mirror / Atom feed
* [PATCH 0/2] rust: revocable: fix potential race between concurrent revokers
@ 2026-06-18 19:32 Danilo Krummrich
  2026-06-18 19:32 ` [PATCH 1/2] pin-init: add PinInit::map_err() for error type conversion Danilo Krummrich
  2026-06-18 19:32 ` [PATCH 2/2] rust: revocable: fix race between concurrent revokers Danilo Krummrich
  0 siblings, 2 replies; 6+ messages in thread
From: Danilo Krummrich @ 2026-06-18 19:32 UTC (permalink / raw)
  To: lossin, gary, ojeda, boqun, bjorn3_gh, a.hindborg, aliceryhl,
	tmgross, daniel.almeida, tamird, acourbot, work, lyude,
	deborah.brouwer
  Cc: rust-for-linux, driver-core, Danilo Krummrich

Fix a race condition caused by not considering that Revocable does not guarantee
the wrapped object has been fully dropped by the time revoke() or
revoke_nosync() returns false.

There is currently no actual bug caused by this, but it causes SGTable and
Lyude's patch in [1] to be unsound.

Since Completion::new() is infallible but Revocable::new() is generic over the
error type, the first patch adds PinInit::map_err() to bridge the error type
mismatch.

This can either go separately or together with Lyude's patch. Both cases are
unlikely to ever hit this problem, so it should be fine either way.

[1] https://lore.kernel.org/dri-devel/20260612194436.585385-5-lyude@redhat.com/

Danilo Krummrich (2):
  pin-init: add PinInit::map_err() for error type conversion
  rust: revocable: fix race between concurrent revokers

 rust/kernel/revocable.rs | 23 ++++++++++++++++++---
 rust/pin-init/src/lib.rs | 44 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+), 3 deletions(-)


base-commit: 66affa37cfac0aec061cc4bcf4a065b0c52f7e19
-- 
2.54.0


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

end of thread, other threads:[~2026-06-18 22:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-18 19:32 [PATCH 0/2] rust: revocable: fix potential race between concurrent revokers Danilo Krummrich
2026-06-18 19:32 ` [PATCH 1/2] pin-init: add PinInit::map_err() for error type conversion Danilo Krummrich
2026-06-18 19:32 ` [PATCH 2/2] rust: revocable: fix race between concurrent revokers Danilo Krummrich
2026-06-18 21:35   ` Boqun Feng
2026-06-18 22:24     ` Danilo Krummrich
2026-06-18 22:28       ` Boqun Feng

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