Re: [PATCH v4 4/9] rust: cred: add Rust abstraction for `struct cred`

Benno Lossin
2024-02-05T12:20:30Z

On 2/2/24 11:55, Alice Ryhl wrote:
> From: Wedson Almeida Filho <wedsonaf@gmail.com>
>
> Add a wrapper around `struct cred` called `Credential`, and provide
> functionality to get the `Credential` associated with a `File`.
>
> Rust Binder must check the credentials of processes when they attempt to
> perform various operations, and these checks usually take a
> `&Credential` as parameter. The security_binder_set_context_mgr function
> would be one example. This patch is necessary to access these security_*
> methods from Rust.
>
> Signed-off-by: Wedson Almeida Filho <wedsonaf@gmail.com>
> Co-developed-by: Alice Ryhl <aliceryhl@google.com>
> Signed-off-by: Alice Ryhl <aliceryhl@google.com>
> ---
> rust/bindings/bindings_helper.h | 1 +
> rust/helpers.c | 13 ++++++
> rust/kernel/cred.rs | 72 +++++++++++++++++++++++++++++++++
> rust/kernel/file.rs | 13 ++++++
> rust/kernel/lib.rs | 1 +
> 5 files changed, 100 insertions(+)
> create mode 100644 rust/kernel/cred.rs

Reviewed-by: Benno Lossin <benno.lossin@proton.me>

--
Cheers,
Benno