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] [day] [month] [year] [list]
Message-Id: <DDJ2MSQ0UJQL.199XI9U29HPXL@kernel.org>
Date: Wed, 15 Oct 2025 19:27:57 +0200
From: "Danilo Krummrich" <dakr@...nel.org>
To: "Markus Probst" <markus.probst@...teo.de>
Cc: "Alice Ryhl" <aliceryhl@...gle.com>, "Miguel Ojeda" <ojeda@...nel.org>,
 "Alex Gaynor" <alex.gaynor@...il.com>, "Lee Jones" <lee@...nel.org>, "Pavel
 Machek" <pavel@...nel.org>, "Lorenzo Stoakes" <lorenzo.stoakes@...cle.com>,
 "Vlastimil Babka" <vbabka@...e.cz>, "Liam R. Howlett"
 <Liam.Howlett@...cle.com>, "Uladzislau Rezki" <urezki@...il.com>, "Boqun
 Feng" <boqun.feng@...il.com>, "Gary Guo" <gary@...yguo.net>,
 <bjorn3_gh@...tonmail.com>, "Benno Lossin" <lossin@...nel.org>, "Andreas
 Hindborg" <a.hindborg@...nel.org>, "Trevor Gross" <tmgross@...ch.edu>,
 <rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
 <linux-leds@...r.kernel.org>
Subject: Re: [PATCH v4 2/2] rust: leds: add basic led classdev abstractions

On Wed Oct 15, 2025 at 5:02 PM CEST, Markus Probst wrote:
> Not necessarily every, like I said `container::Device` itself also
> would implement `device::Container` (still allowing &Device<Bound>).

Sure, but eventually we'll need all bus devices to implement it because you want
to be able to use this class device on any bus.

> We already know the address of it with the `struct led_classdev`-
>`parent` field, we just need to substract the offset from `<T as
> Container>::Offset`, and we have the address of the device container
> (like `struct i2c_client`). No Box needed.

Yeah, that should work.

What I still don't like about it (and didn't like back then when I thought about
something similar) is that this provides a publicly accessible unsafe way to
upcast from a generic device to a bus device.

However, I do see the ergonomic advantage for drivers. Even though I'd say it's
minor, it is indeed nice that the class device callbacks can already carry the
actual parent bus device.

So, I'm fine giving this a shot. If go for an implementation, please name the
trait something along the lines of device::IntoBusDevice, device::Container is
too generic. Only bus devices have a DeviceContext.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ