From: Alice Ryhl <aliceryhl@google.com>
To: Sagar Taunk <sagartaunk2@gmail.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Tamir Duberstein" <tamird@kernel.org>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Viresh Kumar" <viresh.kumar@linaro.org>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] rust: workqueue: replace SAFETY TODO for `WorkItemPointer` impl on `Pin<KBox<T>>`
Date: Thu, 30 Apr 2026 08:41:41 +0000 [thread overview]
Message-ID: <afMVxV9iVgfllkkE@google.com> (raw)
In-Reply-To: <20260430071930.73696-1-sagartaunk2@gmail.com>
On Thu, Apr 30, 2026 at 12:49:28PM +0530, Sagar Taunk wrote:
> The original implementation left a `SAFETY: TODO` comment on the
> `WorkItemPointer` implementation for `Pin<KBox<T>>`. This patch documents
> the safety requirements that make this implementation sound.
>
> The safety argument follows the same structure as the `Arc<T>`
> implementation and relies on three guarantees:
> `__enqueue` strips the `Pin` wrapper via `Pin::into_inner_unchecked`
> and leaks the box via `KBox::into_raw`, producing `*mut T` whose
> allocation remains live for the duration of the queued work;
> `work_container_of` safely reverses the `raw_get_work` offset arithmetic to
> recover the exact `*mut T` that `__enqueue` produced; and the workqueue
> guarantees `run` is called exactly once, making `KBox::from_raw` sound.
>
> Signed-off-by: Sagar Taunk <sagartaunk2@gmail.com>
Thanks
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
prev parent reply other threads:[~2026-04-30 8:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 7:19 [PATCH v2] rust: workqueue: replace SAFETY TODO for `WorkItemPointer` impl on `Pin<KBox<T>>` Sagar Taunk
2026-04-30 8:41 ` Alice Ryhl [this message]
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=afMVxV9iVgfllkkE@google.com \
--to=aliceryhl@google.com \
--cc=a.hindborg@kernel.org \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=sagartaunk2@gmail.com \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=viresh.kumar@linaro.org \
/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