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: <DG5H9N9QKZUW.3KLJW09OBNRD0@kernel.org>
Date: Tue, 03 Feb 2026 17:46:39 +0100
From: "Danilo Krummrich" <dakr@...nel.org>
To: "Greg Kroah-Hartman" <gregkh@...uxfoundation.org>
Cc: "Matthew Maurer" <mmaurer@...gle.com>, "Bjorn Andersson"
 <andersson@...nel.org>, "Konrad Dybcio" <konradybcio@...nel.org>, "Satya
 Durga Srinivasu Prabhala" <satyap@...cinc.com>, "Miguel Ojeda"
 <ojeda@...nel.org>, "Boqun Feng" <boqun.feng@...il.com>, "Gary Guo"
 <gary@...yguo.net>, Björn Roy Baron
 <bjorn3_gh@...tonmail.com>, "Benno Lossin" <lossin@...nel.org>, "Andreas
 Hindborg" <a.hindborg@...nel.org>, "Alice Ryhl" <aliceryhl@...gle.com>,
 "Trevor Gross" <tmgross@...ch.edu>, "Daniel Almeida"
 <daniel.almeida@...labora.com>, "Rafael J. Wysocki" <rafael@...nel.org>,
 "David Airlie" <airlied@...il.com>, "Simona Vetter" <simona@...ll.ch>,
 "Michal Wilczynski" <m.wilczynski@...sung.com>, "Dave Ertman"
 <david.m.ertman@...el.com>, "Ira Weiny" <ira.weiny@...el.com>, "Leon
 Romanovsky" <leon@...nel.org>, "Trilok Soni" <tsoni@...cinc.com>,
 <linux-kernel@...r.kernel.org>, <linux-arm-msm@...r.kernel.org>,
 <rust-for-linux@...r.kernel.org>, <driver-core@...ts.linux.dev>,
 <dri-devel@...ts.freedesktop.org>, <linux-pwm@...r.kernel.org>
Subject: Re: [PATCH v2 3/6] rust: device: Support testing devices for
 equality

On Tue Feb 3, 2026 at 5:40 PM CET, Greg Kroah-Hartman wrote:
> On Tue, Feb 03, 2026 at 05:29:16PM +0100, Danilo Krummrich wrote:
>> On Tue Feb 3, 2026 at 5:17 PM CET, Greg Kroah-Hartman wrote:
>> > And I don't see what patch in this series uses this, am I missing it?
>> 
>> 	impl Smem {
>> 	    pub(crate) fn access<'a>(&'a self, dev: &'a Device<Bound>) -> Option<&'a Mmio> {
>> 	        if *dev != *self.dev {
>> 	            return None;
>> 	        }
>> 	
>> 	        // SAFETY: By our invariant, this was a subrange of what was returned by smem_aux_get, for
>> 	        // self.dev, and by our above check, that auxdev is still available.
>> 	        Some(unsafe { Mmio::from_raw(&self.raw) })
>> 	    }
>> 	}
>> 
>> It's used to ensure that the Smem provided by the auxiliary parent can only be
>> accessed as long as the auxiliary parent device is bound.
>
> But how can a parent device ever bevome "unbound"?

It can't, that's why auxiliary::Device::parent() returns a &Device<Bound>, i.e.
as long as the child is bound the parent is guaranteed to be bound as well.

The point in this implementation is that we need to prove to the resource
container (Smem) that we are allowed to access the resource, since it is only
valid to access for the duration the parent is bound.

In the end this is equivalent to Devres::access(), which bypasses the Revocable
if we can prove that we are in a &Device<Bound> scope.

Having that said, the code should probably just use Devres instead. :)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ