anbox / anbox-modules

Anbox kernel modules
327 stars 224 forks source link

binder: compilability with kernel 5.10 #71

Open mikhailnov opened 3 years ago

mikhailnov commented 3 years ago

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 commented 3 years ago

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:

$ 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
sudo-sid13 commented 3 years ago

so did you manage to get them working?

Fuseteam commented 2 years ago

is this superceded by #76 ?