[PATCH v2] cred: rust: mark Credential methods inline
Paul Moore
paul at paul-moore.com
Tue Mar 4 22:07:48 UTC 2025
On Mar 4, 2025 Alice Ryhl <aliceryhl at google.com> wrote:
>
> When you build the kernel using the llvm-19.1.4-rust-1.83.0-x86_64
> toolchain provided by kernel.org with ARCH=arm64, the following symbols
> are generated:
>
> $ nm out-linux/vmlinux | grep ' _R'.*Credential | rustfilt
> ffffffc0808fc540 T <kernel::cred::Credential>::get_secid
> ffffffc0808fc588 T <kernel::cred::Credential as kernel::types::AlwaysRefCounted>::dec_ref
> ffffffc0808fc570 T <kernel::cred::Credential as kernel::types::AlwaysRefCounted>::inc_ref
>
> However, these Rust symbols are trivial wrappers around the functions
> security_cred_getsecid, get_cred, and put_cred respectively. It doesn't
> make sense to go through a trivial wrapper for these functions, so mark
> them inline. Also mark other trivial methods inline to prevent similar
> cases in the future.
>
> After applying this patch, the above command will produce no output.
>
> Reviewed-by: Boqun Feng <boqun.feng at gmail.com>
> Reviewed-by: Andreas Hindborg <a.hindborg at kernel.org>
> Reviewed-by: Christian Brauner <brauner at kernel.org>
> Signed-off-by: Alice Ryhl <aliceryhl at google.com>
> ---
> Changes in v2:
> - Reword commit message.
> - Link to v1: https://lore.kernel.org/r/20250303-inline-cred-v1-1-b2527beace76@google.com
> ---
> rust/kernel/cred.rs | 5 +++++
> 1 file changed, 5 insertions(+)
Merged into lsm/dev, thanks everyone!
--
paul-moore.com
More information about the Linux-security-module-archive
mailing list