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: <CAOZdJXVSByiwGWusdajdTVma2aC3ibZtSz9XBpRy4MJrKuxfvw@mail.gmail.com>
Date: Sat, 31 May 2025 05:17:48 -0500
From: Timur Tabi <timur@...nel.org>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: Timur Tabi <timur@...nel.org>, Alexandre Courbot <acourbot@...dia.com>, 
	Danilo Krummrich <dakr@...nel.org>, John Hubbard <jhubbard@...dia.com>, 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 <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>, 
	Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, linux-kernel@...r.kernel.org, 
	rust-for-linux@...r.kernel.org, Timur Tabi <ttabi@...dia.com>
Subject: Re: [PATCH] rust: add basic ELF sections parser

On Sat, May 31, 2025 at 12:45 AM Greg KH <gregkh@...uxfoundation.org> wrote:

> > IMHO, Nova should really do what Nouveau does, and just have the image
> > parser in the driver itself, without any generic Rust code to do it.
> > After all, what Nova needs to do with these images is driver-specific.
>
> Again, no, do not do any firmware image parsing in the kernel please
> unless you can prove exactly why it MUST be done there.

Nouveau is already doing all this, just in C.  This entire argument is
over a 12-line function:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c#n1824

Nouveau needs to do this in kernel space because, once it finds the
appropriate section in the ELF image, it reads a hardware register to
determine how to patch it:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/nouveau/nvkm/falcon/gm200.c#n342

Since this hardware register cannot be read in user-space, this needs
to be done in the kernel.

Please note that there other drivers in Linux that iterate over ELF
sections in order to parse their firmware images:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/imagination/pvr_fw_util.c#n29
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c#n925
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/remoteproc/qcom_q6v5_mss.c#n1374

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ