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: <CAHC9VhS=jWEZqb3MqCtUAJhY9ci8d_N4H6CqWsYU0YmEG=8_yA@mail.gmail.com>
Date: Mon, 21 Apr 2025 15:09:29 -0400
From: Paul Moore <paul@...l-moore.com>
To: Lukas Fischer <kernel@...o11oo.de>
Cc: James Morris <jmorris@...ei.org>, "Serge E. Hallyn" <serge@...lyn.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>, 
	Danilo Krummrich <dakr@...nel.org>, linux-kernel@...r.kernel.org, 
	linux-security-module@...r.kernel.org, rust-for-linux@...r.kernel.org
Subject: Re: [RFC PATCH] lsm: Add Rust bindings with example LSM

On Wed, Apr 16, 2025 at 5:36 PM Lukas Fischer <kernel@...o11oo.de> wrote:
>
> These are the bare necessities to implement an LSM in Rust. They are in
> an early WIP state intended to gather feedback, mainly for the use of
> unsafe.
>
> The LSM is implemented in security/rust_lsm/lsm.rs and uses the bindings
> to the C side directly to set itself up. This is of course not
> production ready, but enough to set up a minimal example of an LSM.
>
> The `lsm_info` struct technically needs to be aligned to
> `size_of::<kernel::ffi::c_ulong>()`, but Rust does not allow this in
> combination with `repr(transparent)`. So far this works, but it seems
> brittle.
>
> To limit the scope of the implementation, the example and bindings only
> cover the `file_permission` hook.
>
> Signed-off-by: Lukas Fischer <kernel@...o11oo.de>
> ---
> As part of my master's thesis, I am developing a Rust-based LSM. These
> are the bindings I have created for that, so that I can register and
> implement an LSM in Rust.

Thanks for sharing this Lukas.  My Rust knowledge is still far too
basic to offer any constructive review of the Rust code, but I'm happy
to see some effort being put into looking at what would be required to
support a LSM written in Rust.

It isn't clear to me if this is simply an exercise in seeing what
Rust/C interfaces would be needed to implement a Rust based LSM, or if
you ultimately have a LSM you would like to submit upstream and this
is the necessary groundwork so you can implement it in Rust.  Unless
it is the latter, I'm not sure this is something that is a candidate
for merging into the upstream Linux kernel as we don't merge "demo"
type LSMs.  If you are intending to develop a proper LSM, we do have
some guidelines that may help explain what is expected:

* https://github.com/LinuxSecurityModule/kernel/blob/main/README.md

-- 
paul-moore.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ