From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Matthew Maurer <mmaurer@google.com>
Cc: "Bjorn Andersson" <andersson@kernel.org>,
"Konrad Dybcio" <konradybcio@kernel.org>,
"Satya Durga Srinivasu Prabhala" <satyap@quicinc.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Michal Wilczynski" <m.wilczynski@samsung.com>,
"Dave Ertman" <david.m.ertman@intel.com>,
"Ira Weiny" <ira.weiny@intel.com>,
"Leon Romanovsky" <leon@kernel.org>,
"Trilok Soni" <tsoni@quicinc.com>,
linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
rust-for-linux@vger.kernel.org, driver-core@lists.linux.dev,
dri-devel@lists.freedesktop.org, linux-pwm@vger.kernel.org
Subject: Re: [PATCH v2 6/6] soc: qcom: socinfo: Convert to Rust
Date: Wed, 4 Feb 2026 09:38:19 +0100 [thread overview]
Message-ID: <2026020409-situated-icing-5a1a@gregkh> (raw)
In-Reply-To: <CAGSQo03Ok1sv4myQk2Ch68rET19ypq4Mm-=82Ue-T-2Z8kaGmA@mail.gmail.com>
On Tue, Feb 03, 2026 at 09:37:50AM -0800, Matthew Maurer wrote:
> On Tue, Feb 3, 2026 at 8:28 AM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> >
> > On Tue, Feb 03, 2026 at 03:46:35PM +0000, Matthew Maurer wrote:
> > > Convert the socinfo driver to Rust for a number of improvements:
> > > * Accessing IO mapped regions through the IO subsystem, rather than
> > > through regular memory accesses.
> >
> > That's good, but the C code could also be "fixed" to do this, right?
>
> Yes, nothing stops the C code from being fixed to do all of this - all
> of this is representable in C code.
Great! How about sending fixes for that first so that older kernels can
benifit from those fixes :)
> > > * Binds the device as an auxiliary device rather than a platform device,
> > > ensuring the mapped IO regions cannot be accessed after the smem
> > > device is removed.
> >
> > I'm all for this, but is this really an aux device? What is the
> > "parent" device of this aux device? Where are the "siblings"? What
> > does sysfs look like before/after this?
>
> The parent of this aux device is qcom-smem. In the prior
> implementation, qcom-smem loads this device through
> `platform_device_register_data` and `platform_device_unregister`,
> holding a reference in its global struct to release it when being
> released. The probe table for the qcom-socinfo driver was empty, so it
> would not probe without an explicit registration.
So it's a "fake" platform device being created? As Bjorn said, moving
this to aux today would probably be good first.
> > > * Adds bounds-checking to all accesses, hardening against a repeat of
> > > CVE-2024-58007
> >
> > How do you now "know" that the bounds checking is correct? The C
> > version also had this, it was just "not correct" :)
>
> While it's technically possible for the Rust code to have an error
> here, the error would not be in the driver, but in the kernel crate.
> The advantage here is that the bounds checking is all centralized, so
> we get it right once, for the entire kernel, instead of needing to get
> it right every time.
I missed where the bounds checking is happening at all here. I see
fields and sizes of fields, but what is verifying that those sizes are
actually correct?
> > And which accesses are you referring to? From userspace? From the
> > kernel? That CVE looks very odd, it's probably not even a real one and
> > should be revoked, right?
> >
>
> That CVE looks like this:
> 1. qcom_smem_get returns an object of size N
> 2. When initializing the `serial_number` field of
> soc_device_attributes, the offset of the serial number field was
> checked as <= N, rather than the *end* of the serial number field.
> 3. This resulted in the driver exposing through sysfs whatever data
> was mapped afterwards, interpreted as a number.
>
> I agree that the severity seems oddly high, given that in practice,
> this will expose the remainder of the IO mapped page - I don't believe
> it crosses a page boundary, so it can't even *really* leak anything.
Where do you see this as "high"? The kernel CNA does NOT give any
severity info for any CVEs that are issued.
If you are looking at the crap that NVD adds, well, it's just that,
crap, that has no actual relevance to anyone and is flat out wrong most
of the time. We have asked them to stop doing this, but so far we have
not gotten a response:
https://github.com/cisagov/vulnrichment/issues/262
In short, for kernel CVEs only look at the data provided by cve.org, or
the raw data provided by the kernel CNA team.
That being said, this seems like a basic "we are just displaying wrong
data in a sysfs file", so it probably should be rejected unless someone
can tell me how it fits the definition of a vulnerability?
As for why it's a CVE at all, it came in as part of the required GSD
import into CVE.org.
> > > +void *qcom_smem_get_aux(struct auxiliary_device *aux, unsigned int host,
> > > + unsigned int item, size_t *size)
> > > +{
> > > + if (IS_ERR(__smem))
> > > + return __smem;
> > > + if (aux->dev.parent != __smem->dev)
> > > + return ERR_PTR(-EINVAL);
> > > + return qcom_smem_get(host, item, size);
> >
> > So you are returning a void pointer? But don't you really know the
> > "type" of what is being asked here? It's a memory chunk, so u8? Or
> > something else? void * feels "rough" here.
> >
> > > +}
> > > +EXPORT_SYMBOL_GPL(qcom_smem_get_aux);
> > > +
> > > /**
> > > * qcom_smem_get() - resolve ptr of size of a smem item
> > > * @host: the remote processor, or -1
> > > @@ -684,6 +710,9 @@ static void *qcom_smem_get_private(struct qcom_smem *smem,
> > > * Looks up smem item and returns pointer to it. Size of smem
> > > * item is returned in @size.
> > > *
> > > + * It is up to the caller to ensure that the qcom_smem device remains
> > > + * loaded by some mechanism when accessing returned memory.
> >
> > What do you mean by "loaded"? You are saying that the caller needs to
> > rely on this driver remaining in memory for that memory to be "valid"?
> >
> > If this is the case, why not take a reference count?
> >
> > > +impl Smem {
> > > + pub(crate) fn access<'a>(&'a self, dev: &'a Device<Bound>) -> Option<&'a Mmio> {
> > > + if *dev != *self.dev {
> >
> > How can this ever happen?
I think you missed these review comments?
thanks,
greg k-h
next prev parent reply other threads:[~2026-02-04 8:38 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-03 15:46 [PATCH v2 0/6] soc: qcom: socinfo: Convert to Rust Matthew Maurer
2026-02-03 15:46 ` [PATCH v2 1/6] rust: Add sparse_array! helper macro Matthew Maurer
2026-02-03 15:46 ` [PATCH v2 2/6] rust: io: Support copying arrays and slices Matthew Maurer
2026-02-03 15:53 ` Danilo Krummrich
2026-02-03 15:46 ` [PATCH v2 3/6] rust: device: Support testing devices for equality Matthew Maurer
2026-02-03 15:56 ` Danilo Krummrich
2026-02-03 16:05 ` Gary Guo
2026-02-03 16:15 ` Greg Kroah-Hartman
2026-02-03 16:17 ` Greg Kroah-Hartman
2026-02-03 16:29 ` Danilo Krummrich
2026-02-03 16:40 ` Greg Kroah-Hartman
2026-02-03 16:46 ` Danilo Krummrich
2026-02-03 17:17 ` Matthew Maurer
2026-02-03 15:46 ` [PATCH v2 4/6] rust: auxiliary: Support accessing raw aux pointer Matthew Maurer
2026-02-03 15:55 ` Danilo Krummrich
2026-02-03 15:46 ` [PATCH v2 5/6] rust: debugfs: Allow access to device in Devres-wrapped scopes Matthew Maurer
2026-02-03 15:59 ` Danilo Krummrich
2026-02-03 16:47 ` Gary Guo
2026-02-03 16:58 ` Danilo Krummrich
2026-02-03 18:04 ` Matthew Maurer
2026-02-03 15:46 ` [PATCH v2 6/6] soc: qcom: socinfo: Convert to Rust Matthew Maurer
2026-02-03 16:28 ` Greg Kroah-Hartman
2026-02-03 16:35 ` Danilo Krummrich
2026-02-03 16:48 ` Greg Kroah-Hartman
2026-02-03 16:56 ` Danilo Krummrich
2026-02-03 17:17 ` Gary Guo
2026-02-03 17:26 ` Matthew Maurer
2026-02-03 17:59 ` Danilo Krummrich
2026-02-03 17:37 ` Matthew Maurer
2026-02-04 8:38 ` Greg Kroah-Hartman [this message]
2026-02-03 20:27 ` Bjorn Andersson
2026-02-04 8:40 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2026020409-situated-icing-5a1a@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=a.hindborg@kernel.org \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=andersson@kernel.org \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=david.m.ertman@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=driver-core@lists.linux.dev \
--cc=gary@garyguo.net \
--cc=ira.weiny@intel.com \
--cc=konradybcio@kernel.org \
--cc=leon@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=m.wilczynski@samsung.com \
--cc=mmaurer@google.com \
--cc=ojeda@kernel.org \
--cc=rafael@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=satyap@quicinc.com \
--cc=simona@ffwll.ch \
--cc=tmgross@umich.edu \
--cc=tsoni@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox