mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Greg KH" <gregkh@linuxfoundation.org>,
	"John Hubbard" <jhubbard@nvidia.com>
Cc: "Timur Tabi" <timur@kernel.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org
Subject: Re: [PATCH] rust: add basic ELF sections parser
Date: Fri, 16 May 2025 22:26:10 +0900	[thread overview]
Message-ID: <D9XMAV4ERYK7.39TLQBLYTX3TU@nvidia.com> (raw)
In-Reply-To: <2025051647-urology-think-b8e0@gregkh>

On Fri May 16, 2025 at 10:15 PM JST, Greg KH wrote:
> On Thu, May 15, 2025 at 12:17:00PM -0700, John Hubbard wrote:
>> On 5/15/25 7:30 AM, Timur Tabi wrote:
>> > On Thu, May 15, 2025 at 6:43 AM Greg KH <gregkh@linuxfoundation.org> wrote:
>> >>> Or if ELF is the problem, I don't mind introducing a WAD loader. ;)
>> >>
>> >> The "problem" I'm not understanding is why does the kernel have to do
>> >> any of this parsing at all?
>> > 
>> > Nova will need to parse ELF headers in order to properly load and boot
>> > Nvidia firmware images.  Nouveau does this already:
>> > 
>> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c#n2931
>> 
>> Hi Greg!
>> 
>> Nouveau influenced us heavily here, because having firmware that we
>> can post once, and use everywhere (Nouveau and Nova), is very attractive.
>> 
>> Alex and Timur discuss other details that explain why the standard 
>> user-space approach is less simple and clean than it might appear at
>> first glance, but I wanted to emphasize that the firmware re-use point
>> a little bit, too.
>> 
>> Oh, and also: the ELF images are going to remain extremely simple,
>> because there is nothing now (nor can I see anything in the future)
>> that would drive anyone to do complicated things. For example, if
>> there is some exotic new thing in the future, it could be put into
>> its own firmware image if necessary--because we understand that
>> this parser here is intended to be a simple subset of ELF, and
>> left alone really.
>
> Ok, then why not just bury this down in the driver that is going to
> actually use it?  This patch series was adding it to ALL kernels, if you
> need/want it or not, and as such would be seen as a generic way to
> handle all ELF images.  But as that's not the case here, just copy what
> you did in the existing C driver and make it private to your code, so
> that no one else has to worry about accidentally thinking it would also
> work for their code :)

Keeping this local to nova-core is perfectly fine if you think this is
more acceptable. AFAIK there are no other users for it at the moment.

> And I still think that having the kernel do this is a mistake, firmware
> should always just be a "pass through" otherwise you open yourself up to
> all sorts of complexity and vulnerabilities in the kernel, both of which
> is generally not a good idea.

I agree on principle, but I cannot think of a way to avoid doing this in
the kernel without making things overly complex. We're happy to consider
alternatives though, if they exist.

  reply	other threads:[~2025-05-16 13:26 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-15  6:03 Alexandre Courbot
2025-05-15  7:38 ` Greg KH
2025-05-15  8:32   ` Alexandre Courbot
2025-05-15 11:25     ` Alexandre Courbot
2025-05-15 11:42       ` Greg KH
2025-05-15 13:09         ` Alexandre Courbot
2025-05-15 14:30         ` Timur Tabi
2025-05-15 19:17           ` John Hubbard
2025-05-16 13:15             ` Greg KH
2025-05-16 13:26               ` Alexandre Courbot [this message]
2025-05-16 13:32                 ` Greg KH
2025-05-16 13:35                 ` Danilo Krummrich
2025-05-16 14:35                   ` Alexandre Courbot
2025-05-16 16:01                     ` Danilo Krummrich
2025-05-16 19:00                       ` John Hubbard
2025-05-17 10:13                         ` Danilo Krummrich
2025-05-17 13:41                           ` Alexandre Courbot
2025-05-16 16:28                     ` Timur Tabi
2025-05-17  0:51                       ` Alexandre Courbot
2025-05-29  6:53                         ` Alexandre Courbot
2025-05-29  8:01                           ` Greg KH
2025-05-30  0:58                             ` Alexandre Courbot
2025-05-30  6:21                               ` Greg KH
2025-05-30  6:56                                 ` Alexandre Courbot
2025-05-30  9:00                                   ` Greg KH
2025-05-30  6:22                               ` Greg KH
2025-05-30  6:59                                 ` Alexandre Courbot
2025-05-30  9:01                                   ` Greg KH
2025-05-30 14:34                                     ` Alexandre Courbot
2025-05-30 15:42                                       ` Greg KH
2025-05-30 18:10                                         ` Timur Tabi
2025-05-31  5:45                                           ` Greg KH
2025-05-31 10:17                                             ` Timur Tabi
2025-05-31 12:25                                               ` Greg KH
2025-05-31 14:38                                                 ` Timur Tabi
2025-05-31 15:28                                                   ` Danilo Krummrich
2025-06-01  7:48                                                   ` Greg KH
2025-05-31 12:33                                             ` Alexandre Courbot
2025-05-31 13:30                                               ` Greg KH
2025-06-01 12:23                                                 ` Alexandre Courbot
2025-06-13  3:32                                                 ` Alexandre Courbot
2025-06-24 14:26                                                   ` Greg KH
2025-06-24 14:51                                                     ` Danilo Krummrich

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=D9XMAV4ERYK7.39TLQBLYTX3TU@nvidia.com \
    --to=acourbot@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=timur@kernel.org \
    --cc=tmgross@umich.edu \
    /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

all inboxes | Powered by JetHome®