File: android-enable-building-binder-as-module.patch

package info (click to toggle)
linux 6.18.9-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,742,212 kB
  • sloc: ansic: 26,783,651; asm: 272,129; sh: 148,799; python: 79,242; makefile: 57,742; perl: 36,527; xml: 19,542; cpp: 5,911; yacc: 4,939; lex: 2,950; awk: 1,607; sed: 30; ruby: 25
file content (65 lines) | stat: -rw-r--r-- 2,246 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From: Ben Hutchings <ben@decadent.org.uk>
Date: Tue, 08 Jul 2025 13:30:55 +0200
Subject: android: Enable building binder as module
Bug-Debian: https://bugs.debian.org/901492

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

- Change the Makefiles to build the driver as an object with the
  "_linux" suffix (which is what Waydroid expects)
- Change config symbol types to tristate
- Add a module description, because modpost warns about missing
  descriptions
---
 drivers/android/Kconfig        |    2 +-
 drivers/android/Makefile       |    7 ++++---
 drivers/android/binder_alloc.c |    2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

--- a/drivers/android/Kconfig
+++ b/drivers/android/Kconfig
@@ -2,7 +2,7 @@
 menu "Android"
 
 config ANDROID_BINDER_IPC
-	bool "Android Binder IPC Driver"
+	tristate "Android Binder IPC Driver"
 	depends on MMU
 	depends on NET
 	default n
--- a/drivers/android/Makefile
+++ b/drivers/android/Makefile
@@ -1,7 +1,8 @@
 # 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 binder_netlink.o
-obj-$(CONFIG_ANDROID_BINDER_ALLOC_KUNIT_TEST)	+= tests/
+obj-$(CONFIG_ANDROID_BINDER_IPC)	+= binder_linux.o
+binder_linux-y := binder.o binder_alloc.o binder_netlink.o
+binder_linux-$(CONFIG_ANDROID_BINDERFS)	+= binderfs.o
+binder_linux-$(CONFIG_ANDROID_BINDER_ALLOC_KUNIT_TEST)	+= tests/
 obj-$(CONFIG_ANDROID_BINDER_IPC_RUST)	+= binder/
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -7164,3 +7164,6 @@
 
 #define CREATE_TRACE_POINTS
 #include "binder_trace.h"
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("Android Binder IPC Driver");
--- a/drivers/android/binder_alloc.c
+++ b/drivers/android/binder_alloc.c
@@ -39,7 +39,7 @@
 };
 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...) \