anbox-modules icon indicating copy to clipboard operation
anbox-modules copied to clipboard

binder: compilability with kernel 5.10

Open mikhailnov opened this issue 3 years ago • 3 comments

Both kernel modules from the tree of this commit are compilable on kernel 5.10 The kernel has to be build with commit 0bd476e6c6 ("kallsyms: unexport kallsyms_lookup_name() and kallsyms_on_each_symbol()") reverted, because both Anbox modules require kallsyms_lookup_name.

[user@rosa2019 binder]$ make KERNEL_SRC=/lib/modules/5.10.4-generic-2rosa2019.1-x86_64/build
make -C /lib/modules/5.10.4-generic-2rosa2019.1-x86_64/build V=0 M=$PWD
make[1]: вход в каталог «/usr/src/linux-5.10.4-generic-2rosa2019.1-x86_64»
  CC [M]  /mnt/dev/sources/anbox-modules/binder/binder.o
  LD [M]  /mnt/dev/sources/anbox-modules/binder/binder_linux.o
  MODPOST /mnt/dev/sources/anbox-modules/binder/Module.symvers
ERROR: modpost: "kallsyms_lookup_name" [/mnt/dev/sources/anbox-modules/binder/binder_linux.ko] undefined!
make[2]: *** [scripts/Makefile.modpost:111: /mnt/dev/sources/anbox-modules/binder/Module.symvers] Ошибка 1
make[2]: *** Удаляется файл «/mnt/dev/sources/anbox-modules/binder/Module.symvers»
make[1]: *** [Makefile:1697: modules] Ошибка 2
make[1]: выход из каталога «/usr/src/linux-5.10.4-generic-2rosa2019.1-x86_64»
make: *** [Makefile:8: all] Ошибка 2
[user@rosa2019 binder]$ ьфлу^C
[user@rosa2019 binder]$ make
make -C /lib/modules/5.4.83-generic-2rosa2019.1-x86_64/build V=0 M=$PWD
make[1]: вход в каталог «/usr/src/linux-5.4.83-generic-2rosa2019.1-x86_64»
  AR      /mnt/dev/sources/anbox-modules/binder/built-in.a
  CC [M]  /mnt/dev/sources/anbox-modules/binder/deps.o
  CC [M]  /mnt/dev/sources/anbox-modules/binder/binder.o
  LD [M]  /mnt/dev/sources/anbox-modules/binder/binder_linux.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC [M]  /mnt/dev/sources/anbox-modules/binder/binder_linux.mod.o
  LD [M]  /mnt/dev/sources/anbox-modules/binder/binder_linux.ko
make[1]: выход из каталога «/usr/src/linux-5.4.83-generic-2rosa2019.1-x86_64»

This kernel commit changed API: https://github.com/torvalds/linux/commit/9740ca4e95b43

mikhailnov avatar Jan 01 '21 17:01 mikhailnov

This patch is incorrect, the kernel modules builds but does not work correctly:

[Сб янв  2 16:39:05 2021] binder_linux: 6162: binder_alloc_buf failed to map page at 0000000035375c15 in kernel
[Сб янв  2 16:39:05 2021] binder_linux: binder_mmap: 6162 f6e82000-f6f80000 alloc small buf failed -12

It is easier to build ashmem and binder from the upstream Linux kernel by porting the following commits from Ubuntu kernel:

  • https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/focal/commit/?id=7670e0531b9a9c7b230adb327f7a7e4e69a414fa
  • https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/focal/commit/?id=ceaf03b459e3adaaee6e914146cec8a3d8bee543
  • https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/focal/commit/?id=94a0f0dce381f2ed49dd33ca1b985adc3f58b716
$ cat 0/@/boot/config-5.4.0-59-generic | grep -iE 'ashmem|bind'
<...>
CONFIG_ASHMEM=m
CONFIG_ANDROID_BINDER_IPC=m
CONFIG_ANDROID_BINDERFS=m
CONFIG_ANDROID_BINDER_DEVICES=""
# CONFIG_ANDROID_BINDER_IPC_SELFTEST is not set

mikhailnov avatar Jan 02 '21 16:01 mikhailnov

so did you manage to get them working?

sudo-sid13 avatar Jan 31 '21 08:01 sudo-sid13

is this superceded by #76 ?

Fuseteam avatar Oct 27 '21 15:10 Fuseteam