[PATCH v2] lsm: rust: mark SecurityCtx methods inline
Paul Moore
paul at paul-moore.com
Tue Mar 4 20:42:35 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 vmlinux | grep ' _R'.*SecurityCtx | rustfilt
> ffffffc0808fe8a0 T <kernel::security::SecurityCtx>::from_secid
> ffffffc0808fe9a4 T <kernel::security::SecurityCtx as core::ops::drop::Drop>::drop
>
> However, these Rust symbols are trivial wrappers around the functions
> security_secid_to_secctx and security_release_secctx 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: Andreas Hindborg <a.hindborg at kernel.org>
> Signed-off-by: Alice Ryhl <aliceryhl at google.com>
> Reviewed-by: Fiona Behrens <me at kloenk.dev>
> ---
> Changes in v2:
> - Reword commit message.
> - Link to v1: https://lore.kernel.org/r/20250303-inline-securityctx-v1-1-fb7b9b641fdf@google.com
> ---
> I will also reword "destroy"/"free" to "release" as suggested by Casey,
> but I'll send a separate patch for that change.
> ---
> rust/kernel/security.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