Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

binder: compilability with kernel 5.10 #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mikhailnov
Copy link

@mikhailnov mikhailnov commented Jan 1, 2021

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: torvalds/linux@9740ca4e95b43

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: torvalds/linux@9740ca4e95b43
@mikhailnov
Copy link
Author

mikhailnov commented Jan 2, 2021

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
Copy link

so did you manage to get them working?

@Fuseteam
Copy link

is this superceded by #76 ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants