Re: [PATCH v10 5/8] rust: security: add abstraction for secctx
From: Paul Moore
Date: Thu Sep 19 2024 - 03:56:54 EST
On Sun, Sep 15, 2024 at 10:31 AM Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
>
> Add an abstraction for viewing the string representation of a security
> context.
>
> This is needed by Rust Binder because it has a feature where a process
> can view the string representation of the security context for incoming
> transactions. The process can use that to authenticate incoming
> transactions, and since the feature is provided by the kernel, the
> process can trust that the security context is legitimate.
>
> This abstraction makes the following assumptions about the C side:
> * When a call to `security_secid_to_secctx` is successful, it returns a
> pointer and length. The pointer references a byte string and is valid
> for reading for that many bytes.
> * The string may be referenced until `security_release_secctx` is
> called.
> * If CONFIG_SECURITY is set, then the three methods mentioned in
> rust/helpers are available without a helper. (That is, they are not a
> #define or `static inline`.)
>
> Reviewed-by: Benno Lossin <benno.lossin@xxxxxxxxx>
> Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@xxxxxxxxx>
> Reviewed-by: Trevor Gross <tmgross@xxxxxxxxx>
> Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>
> Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
> ---
> rust/bindings/bindings_helper.h | 1 +
> rust/helpers/helpers.c | 1 +
> rust/helpers/security.c | 20 +++++++++++
> rust/kernel/cred.rs | 8 +++++
> rust/kernel/lib.rs | 1 +
> rust/kernel/security.rs | 74 +++++++++++++++++++++++++++++++++++++++++
> 6 files changed, 105 insertions(+)
I doubt my ACK is strictly necessary here since the Rust bindings
aren't actually modifying anything in the LSM, but just in case ...
Acked-by: Paul Moore <paul@xxxxxxxxxxxxxx>
--
paul-moore.com