android: Enable building ashmem and binder as modules
authorBen Hutchings <ben@decadent.org.uk>
Fri, 22 Jun 2018 16:27:00 +0000 (17:27 +0100)
committerSalvatore Bonaccorso <carnil@debian.org>
Fri, 7 Feb 2025 09:43:47 +0000 (10:43 +0100)
Bug-Debian: https://bugs.debian.org/901492

We want to enable use of the Android ashmem and binder drivers to
support Anbox, but they should not be built-in as that would waste
resources and increase security attack surface on systems that don't
need them.

- Add a MODULE_LICENSE declaration to ashmem
- Change the Makefiles to build each driver as an object with the
  "_linux" suffix (which is what Anbox expects)
- Change config symbol types to tristate

Update:
In upstream commit 721412ed3d titled "staging: remove ashmem" the ashmem
driver was removed entirely. Secondary commit message:
"The mainline replacement for ashmem is memfd, so remove the legacy
code from drivers/staging/"
Consequently, the ashmem part of this patch has been removed.

Gbp-Pq: Topic debian
Gbp-Pq: Name android-enable-building-ashmem-and-binder-as-modules.patch

drivers/android/Kconfig
drivers/android/Makefile
drivers/android/binder_alloc.c

index 07aa8ae0a058c50807640d046a0fe3af391cbc13..94a3a86f9bd4f23fb84398e702966e7b1e11a3c9 100644 (file)
@@ -2,7 +2,7 @@
 menu "Android"
 
 config ANDROID_BINDER_IPC
-       bool "Android Binder IPC Driver"
+       tristate "Android Binder IPC Driver"
        depends on MMU
        default n
        help
index c9d3d0c99c25717a4bf6867c10732e5eb9022ad1..55411d9a9c2a1f9baecebe99bbf95812ec0cd6a3 100644 (file)
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 ccflags-y += -I$(src)                  # needed for trace events
 
-obj-$(CONFIG_ANDROID_BINDERFS)         += binderfs.o
-obj-$(CONFIG_ANDROID_BINDER_IPC)       += binder.o binder_alloc.o
-obj-$(CONFIG_ANDROID_BINDER_IPC_SELFTEST) += binder_alloc_selftest.o
+obj-$(CONFIG_ANDROID_BINDER_IPC)       += binder_linux.o
+binder_linux-y := binder.o binder_alloc.o
+binder_linux-$(CONFIG_ANDROID_BINDERFS)        += binderfs.o
+binder_linux-$(CONFIG_ANDROID_BINDER_IPC_SELFTEST) += binder_alloc_selftest.o
index fcbb750b1ccc3f6d33a05974d5b697023e613926..6e60ae13a244f684aa985cb307a4bba5ccf055ca 100644 (file)
@@ -38,7 +38,7 @@ enum {
 };
 static uint32_t binder_alloc_debug_mask = BINDER_DEBUG_USER_ERROR;
 
-module_param_named(debug_mask, binder_alloc_debug_mask,
+module_param_named(alloc_debug_mask, binder_alloc_debug_mask,
                   uint, 0644);
 
 #define binder_alloc_debug(mask, x...) \