From 6c96f52eb04fdfe2ee59883389907bbb15456a49 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Fri, 23 May 2025 21:08:33 +0000 Subject: [PATCH] ANDROID: binder: add ANDROID_BINDER_IPC_RUST_DUMMY Rust does not currently support the kernel-hwaddress sanitizer, so KASAN_SW_TAGS cannot be enabled (other KASAN variants are supported). This means that when building with --kasan_sw_tags, Rust gets disabled, and no rust_binder.ko module is built, which causes a build failure as it's expected to be available as a GKI module. Provide a new option to build a dummy module called rust_binder.ko that can be included in KASAN_SW_TAGS builds. This approach is used because _ARM64_GKI_MODULES_LIST does not currently support select(), so we cannot remove rust_binder.ko from the list of expected modules. Bug: 419603781 Change-Id: I1e24a2f00e1bd38bb60e9ef40c3189e17ef5a687 Signed-off-by: Alice Ryhl --- drivers/android/Kconfig | 9 +++++++++ drivers/android/Makefile | 5 +++++ drivers/android/binder/dummy.c | 15 +++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 drivers/android/binder/dummy.c diff --git a/drivers/android/Kconfig b/drivers/android/Kconfig index f87475aebeed..4f8b32fc248f 100644 --- a/drivers/android/Kconfig +++ b/drivers/android/Kconfig @@ -49,6 +49,15 @@ config ANDROID_BINDER_IPC_RUST To build this as a GKI module, choose m. +config ANDROID_BINDER_IPC_RUST_DUMMY + tristate "Empty module called rust_binder.ko" + depends on ANDROID_BINDER_IPC && !ANDROID_BINDER_IPC_RUST + help + This creates an empty module of the same name as the Rust Binder + module. This option can be used to trick the build system into + thinking that Rust Binder was successfully built in cases where Rust + support is unavailable. + config ANDROID_BINDER_IPC_SELFTEST bool "Android Binder IPC Driver Selftest" depends on ANDROID_BINDER_IPC diff --git a/drivers/android/Makefile b/drivers/android/Makefile index 0b876f863e02..5d619535bdfb 100644 --- a/drivers/android/Makefile +++ b/drivers/android/Makefile @@ -8,5 +8,10 @@ obj-$(CONFIG_ANDROID_VENDOR_HOOKS) += vendor_hooks.o obj-$(CONFIG_ANDROID_DEBUG_KINFO) += debug_kinfo.o obj-$(CONFIG_ANDROID_BINDER_IPC_RUST) += rust_binder.o +obj-$(CONFIG_ANDROID_BINDER_IPC_RUST_DUMMY) += rust_binder.o +ifdef CONFIG_ANDROID_BINDER_IPC_RUST rust_binder-objs := binder/rust_binder.o binder/rust_binderfs.o binder/rust_binder_events.o rust_binder-objs += binder/rust_binder_hooks.o binder/page_range_helper.o +else +rust_binder-objs := binder/dummy.o +endif diff --git a/drivers/android/binder/dummy.c b/drivers/android/binder/dummy.c new file mode 100644 index 000000000000..7e9f6ea3a474 --- /dev/null +++ b/drivers/android/binder/dummy.c @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include +#include + +static int __init rbd_init(void) +{ + pr_warn("Using Rust Binder dummy module"); + return 0; +} + +module_init(rbd_init); +MODULE_DESCRIPTION("Dummy Rust Binder module"); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Alice Ryhl ");