From: Danilo Krummrich <dakr@redhat.com>
To: Luis Chamberlain <mcgrof@kernel.org>
Cc: russ.weight@linux.dev, gregkh@linuxfoundation.org,
chrisi.schrefl@gmail.com, linux-kernel@vger.kernel.org,
rust-for-linux@vger.kernel.org, Gary Guo <gary@garyguo.net>
Subject: Re: [PATCH v2 2/2] firmware_loader: fix soundness issue in `request_internal`
Date: Mon, 8 Jul 2024 23:07:14 +0200 [thread overview]
Message-ID: <ZoxVAiNPqdGChvH8@cassiopeiae> (raw)
In-Reply-To: <ZoxOHxHze2ynJS-q@bombadil.infradead.org>
On Mon, Jul 08, 2024 at 01:37:51PM -0700, Luis Chamberlain wrote:
> On Mon, Jul 08, 2024 at 10:07:21PM +0200, Danilo Krummrich wrote:
> > `request_internal` must be called with one of the following function
> > pointers: request_firmware(), firmware_request_nowarn(),
> > firmware_request_platform() or request_firmware_direct().
> >
> > The previous `FwFunc` alias did not guarantee this, which is unsound.
> >
> > In order to fix this up, implement `FwFunc` as new type with a
> > corresponding type invariant.
> >
> > Reported-by: Gary Guo <gary@garyguo.net>
> > Closes: https://lore.kernel.org/lkml/20240620143611.7995e0bb@eugeo/
> > Signed-off-by: Danilo Krummrich <dakr@redhat.com>
>
> While you're at it, can you go ahead and extend out selftest coverage
I think that'd be good and I thought about it. However, I think it makes more
sense once we got a few more abstractions in place, such that we can come up
with a Rust test module analogue to lib/test_firmware.c. What do you think?
> for the firmware_loader so we can test Rust too? Could these issues
> have been caught with a selftest? If not why not?
This patch isn't actually fixing a real bug. Which is also why I didn't put a
"Fixes" tag.
It's more that without the `FwFunc` type indirection and the corresponding
invariant the safety of `request_internal` isn't guranteed formally.
- Danilo
>
> Luis
>
next prev parent reply other threads:[~2024-07-08 21:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-08 20:07 [PATCH v2 1/2] firmware_loader: annotate doctests as `no_run` Danilo Krummrich
2024-07-08 20:07 ` [PATCH v2 2/2] firmware_loader: fix soundness issue in `request_internal` Danilo Krummrich
2024-07-08 20:37 ` Luis Chamberlain
2024-07-08 21:07 ` Danilo Krummrich [this message]
2024-07-08 22:16 ` Christian Schrefl
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=ZoxVAiNPqdGChvH8@cassiopeiae \
--to=dakr@redhat.com \
--cc=chrisi.schrefl@gmail.com \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=russ.weight@linux.dev \
--cc=rust-for-linux@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).