0002-android-Enable-building-ashmem-and-binder-as-modules.patch 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. From 9917ce49cb4e0d91977f11ce5b04b15856a0d82c Mon Sep 17 00:00:00 2001
  2. From: Ben Hutchings <ben@decadent.org.uk>
  3. Date: Fri, 22 Jun 2018 17:27:00 +0100
  4. Subject: [PATCH 2/2] android: Enable building ashmem and binder as modules
  5. We want to enable use of the Android ashmem and binder drivers to
  6. support Anbox, but they should not be built-in as that would waste
  7. resources and increase security attack surface on systems that don't
  8. need them.
  9. - Add a MODULE_LICENSE declaration to ashmem
  10. - Change the Makefiles to build each driver as an object with the
  11. "_linux" suffix (which is what Anbox expects)
  12. - Change config symbol types to tristate
  13. Update:
  14. In upstream commit 721412ed3d titled "staging: remove ashmem" the ashmem
  15. driver was removed entirely. Secondary commit message:
  16. "The mainline replacement for ashmem is memfd, so remove the legacy
  17. code from drivers/staging/"
  18. Consequently, the ashmem part of this patch has been removed.
  19. ---
  20. drivers/android/Kconfig | 2 +-
  21. drivers/android/Makefile | 7 ++++---
  22. drivers/android/binder_alloc.c | 2 +-
  23. 3 files changed, 6 insertions(+), 5 deletions(-)
  24. diff --git a/drivers/android/Kconfig b/drivers/android/Kconfig
  25. index 07aa8ae0a058..94a3a86f9bd4 100644
  26. --- a/drivers/android/Kconfig
  27. +++ b/drivers/android/Kconfig
  28. @@ -2,7 +2,7 @@
  29. menu "Android"
  30. config ANDROID_BINDER_IPC
  31. - bool "Android Binder IPC Driver"
  32. + tristate "Android Binder IPC Driver"
  33. depends on MMU
  34. default n
  35. help
  36. diff --git a/drivers/android/Makefile b/drivers/android/Makefile
  37. index c9d3d0c99c25..55411d9a9c2a 100644
  38. --- a/drivers/android/Makefile
  39. +++ b/drivers/android/Makefile
  40. @@ -1,6 +1,7 @@
  41. # SPDX-License-Identifier: GPL-2.0-only
  42. ccflags-y += -I$(src) # needed for trace events
  43. -obj-$(CONFIG_ANDROID_BINDERFS) += binderfs.o
  44. -obj-$(CONFIG_ANDROID_BINDER_IPC) += binder.o binder_alloc.o
  45. -obj-$(CONFIG_ANDROID_BINDER_IPC_SELFTEST) += binder_alloc_selftest.o
  46. +obj-$(CONFIG_ANDROID_BINDER_IPC) += binder_linux.o
  47. +binder_linux-y := binder.o binder_alloc.o
  48. +binder_linux-$(CONFIG_ANDROID_BINDERFS) += binderfs.o
  49. +binder_linux-$(CONFIG_ANDROID_BINDER_IPC_SELFTEST) += binder_alloc_selftest.o
  50. diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c
  51. index 662a2a2e2e84..98fcbb0c8325 100644
  52. --- a/drivers/android/binder_alloc.c
  53. +++ b/drivers/android/binder_alloc.c
  54. @@ -38,7 +38,7 @@ enum {
  55. };
  56. static uint32_t binder_alloc_debug_mask = BINDER_DEBUG_USER_ERROR;
  57. -module_param_named(debug_mask, binder_alloc_debug_mask,
  58. +module_param_named(alloc_debug_mask, binder_alloc_debug_mask,
  59. uint, 0644);
  60. #define binder_alloc_debug(mask, x...) \
  61. --
  62. 2.41.0