On Sat Jun 13, 2026 at 7:40 AM BST, Onur Özkan wrote:
> Add a Rust abstraction for sleepable RCU (SRCU), backed by C srcu_struct.
> Provide FFI helpers and a safe wrapper with a guard-based API for read-side
> critical sections.
> 
> Cleanup is handled via `PinnedDrop`. It first checks for active read-side
> sections and emits a warning if any guards were leaked. In that case, it
> waits in `synchronize_srcu()` rather than risking a UAF by freeing the
> `srcu_struct` that is still reachable from the C side. It then uses
> `srcu_barrier()` to drain pending callbacks before finally calling
> `cleanup_srcu_struct()`.
> 
> Signed-off-by: Onur Özkan <[email protected]>

Reviewed-by: Gary Guo <[email protected]>

> ---
>  rust/kernel/sync.rs      |   2 +
>  rust/kernel/sync/srcu.rs | 171 +++++++++++++++++++++++++++++++++++++++
>  2 files changed, 173 insertions(+)
>  create mode 100644 rust/kernel/sync/srcu.rs


Reply via email to