Re: [PATCH RFC 02/20] rust_binder: add binderfs support to Rust binder

From: Greg Kroah-Hartman
Date: Wed Nov 01 2023 - 14:12:48 EST


On Wed, Nov 01, 2023 at 06:01:32PM +0000, Alice Ryhl wrote:
> Add support for accessing the Rust binder driver via binderfs. The
> actual binderfs implementation is done entirely in C, and the
> `rust_binderfs.c` file is a modified version of `binderfs.c` that is
> adjusted to call into the Rust binder driver rather than the C driver.
>
> We have left the binderfs filesystem component in C. Rewriting it in
> Rust would be a large amount of work and requires a lot of bindings to
> the file system interfaces. Binderfs has not historically had the same
> challenges with security and complexity, so rewriting Binderfs seems to
> have lower value than the rest of Binder.
>
> We also add code on the Rust side for binderfs to call into. Most of
> this is left as stub implementation, with the exception of closing the
> file descriptor and the BINDER_VERSION ioctl.
>
> Co-developed-by: Wedson Almeida Filho <wedsonaf@xxxxxxxxx>
> Signed-off-by: Wedson Almeida Filho <wedsonaf@xxxxxxxxx>
> Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
> ---
> drivers/android/Kconfig | 24 ++
> drivers/android/Makefile | 1 +
> drivers/android/context.rs | 144 +++++++
> drivers/android/defs.rs | 39 ++
> drivers/android/process.rs | 251 ++++++++++++
> drivers/android/rust_binder.rs | 196 ++++++++-
> drivers/android/rust_binderfs.c | 866 ++++++++++++++++++++++++++++++++++++++++
> include/linux/rust_binder.h | 16 +
> include/uapi/linux/magic.h | 1 +
> rust/bindings/bindings_helper.h | 2 +
> rust/kernel/lib.rs | 7 +
> scripts/Makefile.build | 2 +-
> 12 files changed, 1547 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/android/Kconfig b/drivers/android/Kconfig
> index fcfd25c9a016..82ed6ddabe1a 100644
> --- a/drivers/android/Kconfig
> +++ b/drivers/android/Kconfig
> @@ -36,6 +36,18 @@ config ANDROID_BINDERFS
> It can be used to dynamically allocate new binder IPC devices via
> ioctls.
>
> +config ANDROID_BINDERFS_RUST
> + bool "Android Binderfs filesystem in Rust"
> + depends on ANDROID_BINDER_IPC_RUST
> + default n

Nit, the default is always 'n', so no need for this line.

Also, it's the middle of the merge window, many of us are busy with
other things and can't review new code until a few weeks from now,
sorry.

greg k-h