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] [day] [month] [year] [list]
Message-ID: <m27c4x2rxa.fsf@posteo.net>
Date: Mon, 10 Mar 2025 08:47:29 +0000
From: Charalampos Mitrodimas <charmitro@...teo.net>
To: Ethan Carter Edwards <ethan@...ancedwards.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,  "Rafael J. Wysocki"
 <rafael@...nel.org>,  Danilo Krummrich <dakr@...nel.org>,  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>,  Nathan
 Chancellor <nathan@...nel.org>,  Nick Desaulniers
 <nick.desaulniers+lkml@...il.com>,  Bill Wendling <morbo@...gle.com>,
  Justin Stitt <justinstitt@...gle.com>,  rust-for-linux@...r.kernel.org,
  linux-kernel@...r.kernel.org,  llvm@...ts.linux.dev
Subject: Re: [PATCH] rust/kernel/faux: mark Registration methods inline

Ethan Carter Edwards <ethan@...ancedwards.com> writes:

> When building the kernel on Arch Linux using on x86_64 with tools:
> $ rustc --version
> rustc 1.84.0 (9fc6b4312 2025-01-07)
> $ cargo --version
> cargo 1.84.0 (66221abde 2024-11-19)

Hi Ethan,

I think stating your Cargo version is unnecessary, we don't use cargo
(atleast not anymore).

> $ clang --version
> clang version 19.1.7
> Target: x86_64-pc-linux-gnu
>
> The following symbols are generated:
> $ nm vmlinux | rg ' _R' | rustfilt | rg faux
> ffffffff81959ae0 T <kernel::faux::Registration>::new
> ffffffff81959b40 T <kernel::faux::Registration as core::ops::drop::Drop>::drop
>
> However, these Rust symbols are wrappers around bindings in the C faux
> code. Inlining these functions removes the middle-man wrapper function
> After applying this patch, the above function signatures disappear.
>
> Link: https://github.com/Rust-for-Linux/linux/issues/1145
> Signed-off-by: Ethan Carter Edwards <ethan@...ancedwards.com>
> ---
>  rust/kernel/faux.rs | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/rust/kernel/faux.rs b/rust/kernel/faux.rs
> index 5acc0c02d451f6d5a26b837d509374d508f26368..5fdd85ea64398130066d38e42f7c7485673f290c 100644
> --- a/rust/kernel/faux.rs
> +++ b/rust/kernel/faux.rs
> @@ -24,6 +24,7 @@
>  
>  impl Registration {
>      /// Create and register a new faux device with the given name.
> +    #[inline]
>      pub fn new(name: &CStr) -> Result<Self> {
>          // SAFETY:
>          // - `name` is copied by this function into its own storage
> @@ -50,6 +51,7 @@ fn as_ref(&self) -> &device::Device {
>  }
>  
>  impl Drop for Registration {
> +    #[inline]
>      fn drop(&mut self) {
>          // SAFETY: `self.0` is a valid registered faux_device via our type invariants.
>          unsafe { bindings::faux_device_destroy(self.as_raw()) }
>
> ---
> base-commit: fc2f191f850d9a2fb1b78c51d49076e60fb42c49
> change-id: 20250309-faux-inline-6c8eead1bcd0
>
> Best regards,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ