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: <CAGSQo02gw0hB8gBYTpEmkaa9GfDHQ82-J6q+ksBb29zukkDeFg@mail.gmail.com>
Date: Sat, 13 Dec 2025 09:08:42 -0800
From: Matthew Maurer <mmaurer@...gle.com>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: Bjorn Andersson <andersson@...nel.org>, Konrad Dybcio <konradybcio@...nel.org>, 
	Satya Durga Srinivasu Prabhala <satyap@...cinc.com>, Miguel Ojeda <ojeda@...nel.org>, 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>, Trilok Soni <tsoni@...cinc.com>, linux-kernel@...r.kernel.org, 
	linux-arm-msm@...r.kernel.org, rust-for-linux@...r.kernel.org
Subject: Re: [PATCH RFC] soc: qcom: socinfo: Re-implement in Rust

On Sat, Dec 13, 2025 at 8:24 AM Matthew Maurer <mmaurer@...gle.com> wrote:
>
> On Sat, Dec 13, 2025 at 5:57 AM Greg KH <gregkh@...uxfoundation.org> wrote:
> >
> > Shouldn't this all just be in 1 .rs file?  By not doing that, you have a
> > number of public symbols (that are very generic), that will "pollute"

One other comment - unless you see `#[no_mangle]` on a Rust symbol,
don't worry about the symbol name being generic. The regular symbols
are all mangled with their path and some Rust compiler info, so for
example, `SOC_IDS` is actually a mangled variant of
`socinfo::data::SOC_IDS`.

> > the global namespace of the kernel symbol table (unless rust does this
> > somehow differently?)
>
> Rust produces one compilation unit per "crate". In this case,
> `socinfo` is the crate, and the other files are included as "modules".
> Symbols defined in them are not public unless annotated with `pub`.
> `pub(crate)` makes them only exported within the scope of the crate,
> i.e. inside the single produced `.o` file.

Slight further clarification - putting them in a separate file doesn't
affect visibility in the final `.o` file that's produced, but it is
technically possible for functions or data which are not public at the
language level to be public at the object level, usually due to
polymorphism. Additionally, an item being `pub` in a module doesn't
necessarily get exported at the language level unless the module
declaration itself is `pub` or the parent module re-exports it
explicitly through `pub use`.

>
> > But putting this all in 1 file should solve all of that, and remove all
> > global symbols.  Especially for just a small and simple driver like
> > this, no need to split it up at all.
>
> I'm willing to put it all in one file if that's preferred for
> organizational purposes, but as explained above, this shouldn't bloat
> the symbol count in Rust. If it were my own codebase this would be
> separate files, so up to y'all what level of granularity you'd prefer.
>
> >
> > thanks,
> >
> > greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ