lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aF7YWE4bz98Gqh1y@tardis.local>
Date: Fri, 27 Jun 2025 10:43:52 -0700
From: Boqun Feng <boqun.feng@...il.com>
To: Alice Ryhl <aliceryhl@...gle.com>
Cc: Tejun Heo <tj@...nel.org>, Miguel Ojeda <ojeda@...nel.org>,
	Alex Gaynor <alex.gaynor@...il.com>,
	Lai Jiangshan <jiangshanlai@...il.com>, Gary Guo <gary@...yguo.net>,
	Björn Roy Baron <bjorn3_gh@...tonmail.com>,
	Andreas Hindborg <a.hindborg@...nel.org>,
	Trevor Gross <tmgross@...ch.edu>,
	Danilo Krummrich <dakr@...nel.org>,
	Daniel Almeida <daniel.almeida@...labora.com>,
	Tamir Duberstein <tamird@...il.com>, rust-for-linux@...r.kernel.org,
	linux-kernel@...r.kernel.org, Benno Lossin <lossin@...nel.org>
Subject: Re: [PATCH v2] workqueue: rust: add delayed work items

On Fri, Jun 27, 2025 at 09:38:42AM +0000, Alice Ryhl wrote:
[...]
> +    /// Get a pointer to the inner `delayed_work`.
> +    ///
> +    /// # Safety
> +    ///
> +    /// The provided pointer must not be dangling and must be properly aligned. (But the memory
> +    /// need not be initialized.)
> +    #[inline]
> +    pub unsafe fn raw_as_work(ptr: *const Self) -> *mut Work<T, ID> {
> +        // SAFETY: The caller promises that the pointer is aligned and not dangling.
> +        let dw: *mut bindings::delayed_work =
> +            unsafe { Opaque::raw_get(core::ptr::addr_of!((*ptr).dwork)) };

This would conflict with your Opaque::cast_into() series ;-) So I
suggest that we rebase this one onto:

	https://lore.kernel.org/rust-for-linux/20250624-opaque-from-raw-v2-0-e4da40bdc59c@google.com/

and send them together. But it's up to you and maintainers, and even we
do that let's wait for some reviews on this patch to save extra
versions.

I'm going to review it, just figure this better be pointed out.

Btw, as a review comment, I believe we are in favor of `&raw mut` now,
so this should be:


    unsafe { Opaque::cast_from(&raw const (*ptr).dwork) };

> +        // SAFETY: The caller promises that the pointer is aligned and not dangling.
> +        let wrk: *mut bindings::work_struct = unsafe { core::ptr::addr_of_mut!((*dw).work) };

Ditto.

Regards,
Boqun

> +        // CAST: Work and work_struct have compatible layouts.
> +        wrk.cast()
> +    }
> +}
[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ