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 <aliceryhl@google.com>
This commit is contained in:
Alice Ryhl
2025-05-23 21:08:33 +00:00
parent 39ce6d6edf
commit 6c96f52eb0
3 changed files with 29 additions and 0 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,15 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/module.h>
#include <linux/init.h>
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 <aliceryhl@google.com>");