[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2025062845-periscope-crayfish-e69a@gregkh>
Date: Sat, 28 Jun 2025 07:07:08 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Matthew Maurer <mmaurer@...gle.com>
Cc: Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
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>,
Danilo Krummrich <dakr@...nel.org>,
"Isaac J. Manjarres" <isaacmanjarres@...gle.com>,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rust: miscdevice: Export vtable testing
On Fri, Jun 27, 2025 at 04:46:04PM -0700, Matthew Maurer wrote:
> On Fri, Jun 27, 2025 at 4:42 PM Matthew Maurer <mmaurer@...gle.com> wrote:
> >
> > A common pattern in the kernel is to test whether a file belongs to a
> > particular driver by checking its `f_op` struct against an expected
> > value. This provides a safe way to perform that test for `MiscDevice`
> > implementations without needing to directly expose the vtable.
> >
> > Signed-off-by: Matthew Maurer <mmaurer@...gle.com>
>
> Additionally, we have a sample user[1] of this in the Android ashmem
> wrapper. They're currently working around it by grabbing the vtable
> out of the registration and testing manually.
>
> [1]: https://android-review.git.corp.google.com/c/kernel/common/+/3477511
As ashmem isn't going to be upstream, it's hard for us to treat this as
a real user :)
Powered by blists - more mailing lists