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: <DAWUGWHZALC1.2FJDIDRG325F@kernel.org>
Date: Fri, 27 Jun 2025 01:13:30 +0200
From: "Benno Lossin" <lossin@...nel.org>
To: "Danilo Krummrich" <dakr@...nel.org>
Cc: <gregkh@...uxfoundation.org>, <rafael@...nel.org>, <ojeda@...nel.org>,
 <alex.gaynor@...il.com>, <boqun.feng@...il.com>, <gary@...yguo.net>,
 <bjorn3_gh@...tonmail.com>, <a.hindborg@...nel.org>,
 <aliceryhl@...gle.com>, <tmgross@...ch.edu>, <david.m.ertman@...el.com>,
 <ira.weiny@...el.com>, <leon@...nel.org>, <kwilczynski@...nel.org>,
 <bhelgaas@...gle.com>, <rust-for-linux@...r.kernel.org>,
 <linux-kernel@...r.kernel.org>, <linux-pci@...r.kernel.org>
Subject: Re: [PATCH v3 4/4] rust: devres: implement register_release()

On Thu Jun 26, 2025 at 5:49 PM CEST, Danilo Krummrich wrote:
> On Thu, Jun 26, 2025 at 05:32:25PM +0200, Danilo Krummrich wrote:
>> On Thu, Jun 26, 2025 at 04:41:55PM +0200, Benno Lossin wrote:
>> > On Thu Jun 26, 2025 at 4:02 PM CEST, Danilo Krummrich wrote:
>> > > On Thu, Jun 26, 2025 at 01:15:34PM +0200, Danilo Krummrich wrote:
>> > >> On Thu, Jun 26, 2025 at 12:36:23PM +0200, Benno Lossin wrote:
>> > >> > Or, we could change `Release` to be:
>> > >> > 
>> > >> >     pub trait Release {
>> > >> >         type Ptr: ForeignOwnable;
>> > >> > 
>> > >> >         fn release(this: Self::Ptr);
>> > >> >     }
>> > >> > 
>> > >> > and then `register_release` is:
>> > >> > 
>> > >> >     pub fn register_release<T: Release>(dev: &Device<Bound>, data: T::Ptr) -> Result
>> > >> > 
>> > >> > This way, one can store a `Box<T>` and get access to the `T` at the end.
>> > >> 
>> > >> I think this was also the case before? Well, it was P::Borrowed instead.
>> > >> 
>> > >> > Or if they store the value in an `Arc<T>`, they have the option to clone
>> > >> > it and give it to somewhere else.
>> > >> 
>> > >> Anyways, I really like this proposal of implementing the Release trait.
>> > >
>> > > One downside seems to be that the compiler cannot infer T anymore with this
>> > > function signature.
>> > 
>> > Yeah... That's a bit annoying.
>> > 
>> > We might be able to add an associated type to `ForeignOwnable` like
>> > `Target` or `Inner` or whatever.
>> 
>> I think we already have `PointedTo` [1]? But I remember that I've seen a patch
>> to remove it again [2].
>
> Well, not exactly, I think. Arc, for instance, defines PointedTo as ArcInner<T>.
> So, I think we indeed want something different.

Yeah `PointedTo` is used to specify the type of the foreign pointer and
should go away soon.

---
Cheers,
Benno

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ