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

Compatibility with kernels >= 5.7

Open choff opened this issue 3 years ago • 43 comments

Various changes were made to get the kernel modules for Anbox working with kernels 5.7 and later:

  • Making kallsyms_lookup_name() accessible again with a VERY DIRTY hack that relies on KProbes
  • Two other small compile fixes to make everything compile with kernel 5.8

I know that ashmem and binder are now upstream in the kernel, but there are still many distributions that don't enable ashmem and binder support in their kernel config. In that case, one might still want to try "anbox-modules" if nothing else helps. This patch makes it possible to compile ashmem and binder as kernel modules with such newer kernels. It's surely not a great solution, but it's a solution of last resort.

choff avatar Mar 08 '21 20:03 choff

This seems to work nicely on Fedora 33 with kernel 5.10. However, on Fedora 34 pre-release with kernel 5.11, it doesn't seem like the modules can be built at all. I am not sure if this is an issue with kernel 5.11 or if it is simply because Fedora 34 pre-release is still somewhat buggy, but it would be awesome if you can have a look :)

TommyTran732 avatar Mar 13 '21 14:03 TommyTran732

Oh, and to add a bit more info, dkms was complaining about incompatible gcc/plugin versions when I tried it.

TommyTran732 avatar Mar 13 '21 14:03 TommyTran732

Hello @tommytran732 ,

unfortunately, I cannot invest the time to install Fedora 34 on my machine to duplicate this error... The only kind of help I can offer is to take a look at the error and see if something comes to my mind.. But for this I need the full console output.

Best regards,

Christian

choff avatar Mar 13 '21 14:03 choff

Hi,

Fedora 33 just got updated to kernel 5.11 today and it seems like it broke binder. It is a different error from what I got on Fedora 34 last time, but here are the logs:

`[Tomster@dhcp-172-30-79-244 ~]$ sudo ls -la /dev/{ashmem,binder} [sudo] password for Tomster: ls: cannot access '/dev/binder': No such file or directory crw-------. 1 root root 10, 124 Mar 20 01:08 /dev/ashmem [Tomster@dhcp-172-30-79-244 ~]$ sudo dkms status anbox-ashmem, 1, 5.10.22-200.fc33.x86_64, x86_64: installed anbox-ashmem, 1, 5.10.23-200.fc33.x86_64, x86_64: installed anbox-ashmem, 1, 5.11.7-200.fc33.x86_64, x86_64: installed anbox-binder, 1, 5.10.22-200.fc33.x86_64, x86_64: installed anbox-binder, 1, 5.10.23-200.fc33.x86_64, x86_64: installed [Tomster@dhcp-172-30-79-244 ~]$ sudo dkms install anbox-binder/1

Kernel preparation unnecessary for this kernel. Skipping...

Building module: cleaning build area... make -j12 KERNELRELEASE=5.11.7-200.fc33.x86_64 all KERNEL_SRC=/lib/modules/5.11.7-200.fc33.x86_64/build...(bad exit status: 2) Error! Bad return status for module build on kernel: 5.11.7-200.fc33.x86_64 (x86_64) Consult /var/lib/dkms/anbox-binder/1/build/make.log for more information. [Tomster@dhcp-172-30-79-244 ~]$ cat /var/lib/dkms/anbox-binder/1/build/make.log cat: /var/lib/dkms/anbox-binder/1/build/make.log: Permission denied [Tomster@dhcp-172-30-79-244 ~]$ sudo cat /var/lib/dkms/anbox-binder/1/build/make.log DKMS make.log for anbox-binder-1 for kernel 5.11.7-200.fc33.x86_64 (x86_64) Sat 20 Mar 2021 01:10:05 AM EDT make -C /lib/modules/5.11.7-200.fc33.x86_64/build V=0 M=$PWD make[1]: Entering directory '/usr/src/kernels/5.11.7-200.fc33.x86_64' CC [M] /var/lib/dkms/anbox-binder/1/build/deps.o CC [M] /var/lib/dkms/anbox-binder/1/build/binder.o /var/lib/dkms/anbox-binder/1/build/binder.c: In function ‘task_get_unused_fd_flags’: /var/lib/dkms/anbox-binder/1/build/binder.c:447:9: error: implicit declaration of function ‘__alloc_fd’ [-Werror=implicit-function-declaration] 447 | return __alloc_fd(files, 0, rlim_cur, flags); | ^~~~~~~~~~ /var/lib/dkms/anbox-binder/1/build/binder.c: In function ‘task_fd_install’: /var/lib/dkms/anbox-binder/1/build/binder.c:457:3: error: implicit declaration of function ‘__fd_install’; did you mean ‘fd_install’? [-Werror=implicit-function-declaration] 457 | __fd_install(proc->files, fd, file); | ^~~~~~~~~~~~ | fd_install /var/lib/dkms/anbox-binder/1/build/binder.c: In function ‘task_close_fd’: /var/lib/dkms/anbox-binder/1/build/binder.c:470:11: error: implicit declaration of function ‘__close_fd’; did you mean ‘close_fd’? [-Werror=implicit-function-declaration] 470 | retval = __close_fd(proc->files, fd); | ^~~~~~~~~~ | close_fd /var/lib/dkms/anbox-binder/1/build/binder.c: In function ‘binder_mmap’: /var/lib/dkms/anbox-binder/1/build/binder.c:3501:16: error: implicit declaration of function ‘get_files_struct’; did you mean ‘put_files_struct’? [-Werror=implicit-function-declaration] 3501 | proc->files = get_files_struct(current); | ^~~~~~~~~~~~~~~~ | put_files_struct cc1: some warnings being treated as errors make[2]: *** [scripts/Makefile.build:279: /var/lib/dkms/anbox-binder/1/build/binder.o] Error 1 make[1]: *** [Makefile:1807: /var/lib/dkms/anbox-binder/1/build] Error 2 make[1]: Leaving directory '/usr/src/kernels/5.11.7-200.fc33.x86_64' make: *** [Makefile:8: all] Error 2`

TommyTran732 avatar Mar 20 '21 05:03 TommyTran732

Hello @tommytran732 ,

yes, indeed it seems like some kernel changes broke the build. Unfortunately, I am travelling tomorrow and will be away for the next 3 weeks. Today I need to pack my things and it is unlikely that I find the time to look into it. I will try to have a look after I return.

Best regards,

Christian

chrihoff avatar Mar 20 '21 09:03 chrihoff

Is there any update on this? I'm too facing the same issue

vikashraghavan avatar May 09 '21 06:05 vikashraghavan

Hello @vikashraghavan ,

no, no update on this. And I don't know when / if I will look into it at all because kernel 5.11 is not yet available for Raspsberry Pi OS. If you have the skills (or someone else who is affected), you could try to fix it yourself and set a PR to my branch, which I will be happy to integrate. I cannot give any commitment if I find time for it at all.

Best regards,

Christian

chrihoff avatar May 09 '21 07:05 chrihoff

Hi @chrihoff

I found some patch docs related to the error

__alloc_fd __fd_install __close_fd

I'm not sure whether it would be useful or not. Any assistance would be really helpful if you think it's a simple bug to fix.

vikashraghavan avatar May 09 '21 08:05 vikashraghavan

Hello @vikashraghavan ,

I just had a look at these kernel patches. The links are helpful indeed and pointed me in the right direction. So, it seems like the functions __alloc_fd(), __fd_install() and __close_fd() were removed from the kernel without replacement. However, Binder was refactored upstream upstream in 2018 (see http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2018-August/125424.html). Since that refactoring, binder no longer needs to use these three functions and can use standard functions instead.

So the task here would be to backport this refactoring to binder also to anbox-modules. That should fix those issues. Unfortunately, this refactoring is quite complex and involves some restructuring, so I am not sure how easy it would be to backport it.

Then the only problem remaining would be the compile error in 'binder_mmap' that @tommytran732 reported. As of now, I cannot tell what the root cause of this other error is or how to fix it as I simply didn't have the time to look into it.

Best regards,

Christian

chrihoff avatar May 09 '21 13:05 chrihoff

hey @chrihoff,

I found a binder code for latest kernels binder.c

Is something possible to do with these?

vikashraghavan avatar May 09 '21 15:05 vikashraghavan

Hello @vikashraghavan ,

well, you could try to replace binder.c in anbox-modules by the latest one you found... Maybe you'd need to copy over other files, too... But this is not a generic solution for every user as anbox-modules were designed to be compilable against old kernels also. So, there is a lot of compatibility code in there that is missing in the version of binder.c for the latest kernel.

Best regards,

Christian

chrihoff avatar May 10 '21 05:05 chrihoff

Can you please mention which are the other files to be copied? should all the files in the previous directory should be used?

vikashraghavan avatar May 10 '21 06:05 vikashraghavan

Hello @vikashraghavan ,

unfortunately, I cannot tell and I don't have time to look into it, either. I guess you'd need to try yourself. I am not sure how well this approach works at all...

Best regards,

Christian

chrihoff avatar May 10 '21 06:05 chrihoff

Stuck over here while trying to compile latest binder module

DKMS make.log for anbox-binder-1 for kernel 5.11.18-300.fc34.x86_64 (x86_64) Mon May 10 06:42:54 PM IST 2021 make -C /lib/modules/5.11.18-300.fc34.x86_64/build V=0 M=$PWD make[1]: Entering directory '/usr/src/kernels/5.11.18-300.fc34.x86_64' CC [M] /var/lib/dkms/anbox-binder/1/build/binder.o CC [M] /var/lib/dkms/anbox-binder/1/build/binder_alloc.o LD [M] /var/lib/dkms/anbox-binder/1/build/binder_linux.o MODPOST /var/lib/dkms/anbox-binder/1/build/Module.symvers ERROR: modpost: "can_nice" [/var/lib/dkms/anbox-binder/1/build/binder_linux.ko] undefined! ERROR: modpost: "mmput_async" [/var/lib/dkms/anbox-binder/1/build/binder_linux.ko] undefined! ERROR: modpost: "task_work_add" [/var/lib/dkms/anbox-binder/1/build/binder_linux.ko] undefined! ERROR: modpost: "security_binder_transaction" [/var/lib/dkms/anbox-binder/1/build/binder_linux.ko] undefined! ERROR: modpost: "security_binder_transfer_file" [/var/lib/dkms/anbox-binder/1/build/binder_linux.ko] undefined! ERROR: modpost: "security_binder_set_context_mgr" [/var/lib/dkms/anbox-binder/1/build/binder_linux.ko] undefined! ERROR: modpost: "security_binder_transfer_binder" [/var/lib/dkms/anbox-binder/1/build/binder_linux.ko] undefined! ERROR: modpost: "close_fd_get_file" [/var/lib/dkms/anbox-binder/1/build/binder_linux.ko] undefined! ERROR: modpost: "zap_page_range" [/var/lib/dkms/anbox-binder/1/build/binder_linux.ko] undefined! make[2]: *** [scripts/Makefile.modpost:111: /var/lib/dkms/anbox-binder/1/build/Module.symvers] Error 1 make[2]: *** Deleting file '/var/lib/dkms/anbox-binder/1/build/Module.symvers' make[1]: *** [Makefile:1725: modules] Error 2 make[1]: Leaving directory '/usr/src/kernels/5.11.18-300.fc34.x86_64' make: *** [Makefile:9: all] Error 2

Is there some changes should be done to deps.c? I tried to compile both with and without deps.c (I just suspect it... I really don't know why that file is used)

Any suggestions to direct me in the right way would be really helpful !!!

vikashraghavan avatar May 10 '21 13:05 vikashraghavan

hi, make -C /lib/modules/5.13.0-21-generic/build V=0 M=$PWD make[1]: 进入目录“/usr/src/linux-headers-5.13.0-21-generic” CC [M] /var/lib/dkms/anbox-binder/1/build/deps.o CC [M] /var/lib/dkms/anbox-binder/1/build/binder.o CC [M] /var/lib/dkms/anbox-binder/1/build/binder_alloc.o CC [M] /var/lib/dkms/anbox-binder/1/build/binderfs.o In file included from ././include/linux/kconfig.h:5, from : ./include/generated/autoconf.h:4426: warning: "CONFIG_ANDROID_BINDER_DEVICES" redefined 4426 | #define CONFIG_ANDROID_BINDER_DEVICES "" | : note: this is the location of the previous definition In file included from ././include/linux/kconfig.h:5, from : ./include/generated/autoconf.h:4426: warning: "CONFIG_ANDROID_BINDER_DEVICES" redefined 4426 | #define CONFIG_ANDROID_BINDER_DEVICES "" | : note: this is the location of the previous definition In file included from ././include/linux/kconfig.h:5, from : ./include/generated/autoconf.h:4426: warning: "CONFIG_ANDROID_BINDER_DEVICES" redefined 4426 | #define CONFIG_ANDROID_BINDER_DEVICES "" | : note: this is the location of the previous definition In file included from ././include/linux/kconfig.h:5, from : ./include/generated/autoconf.h:4426: warning: "CONFIG_ANDROID_BINDER_DEVICES" redefined 4426 | #define CONFIG_ANDROID_BINDER_DEVICES "" | : note: this is the location of the previous definition /var/lib/dkms/anbox-binder/1/build/binder.c: In function ‘binder_transaction’: /var/lib/dkms/anbox-binder/1/build/binder.c:3098:55: error: passing argument 2 of ‘security_task_getsecid_obj’ from incompatible pointer type [-Werror=incompatible-pointer-types] 3098 | security_task_getsecid_obj(proc->tsk, &secid); | ^~~~~~ | | | u32 * {aka unsigned int *} In file included from /var/lib/dkms/anbox-binder/1/build/binder.c:63: ./include/linux/security.h:545:72: note: expected ‘struct lsmblob *’ but argument is of type ‘u32 *’ {aka ‘unsigned int *’} 545 | void security_task_getsecid_obj(struct task_struct *p, struct lsmblob *blob); | ~~~~~~~~~~~~~~~~^~~~ /var/lib/dkms/anbox-binder/1/build/binder.c:3102:55: error: passing argument 2 of ‘security_secid_to_secctx’ from incompatible pointer type [-Werror=incompatible-pointer-types] 3102 | ret = security_secid_to_secctx(secid, &secctx, &secctx_sz); | ^~~~~~~ | | | char ** In file included from /var/lib/dkms/anbox-binder/1/build/binder.c:63: ./include/linux/security.h:591:71: note: expected ‘struct lsmcontext *’ but argument is of type ‘char **’ 591 | int security_secid_to_secctx(struct lsmblob *blob, struct lsmcontext *cp, | ~~~~~~~~~~~~~~~~~~~^~ /var/lib/dkms/anbox-binder/1/build/binder.c:3151:41: error: passing argument 1 of ‘security_release_secctx’ from incompatible pointer type [-Werror=incompatible-pointer-types] 3151 | security_release_secctx(secctx, secctx_sz); | ^~~~~~ | | | char * In file included from /var/lib/dkms/anbox-binder/1/build/binder.c:63: ./include/linux/security.h:595:49: note: expected ‘struct lsmcontext *’ but argument is of type ‘char *’ 595 | void security_release_secctx(struct lsmcontext *cp); | ~~~~~~~~~~~~~~~~~~~^~ /var/lib/dkms/anbox-binder/1/build/binder.c:3151:17: error: too many arguments to function ‘security_release_secctx’ 3151 | security_release_secctx(secctx, secctx_sz); | ^~~~~~~~~~~~~~~~~~~~~~~ In file included from /var/lib/dkms/anbox-binder/1/build/binder.c:63: ./include/linux/security.h:595:6: note: declared here 595 | void security_release_secctx(struct lsmcontext *cp); | ^~~~~~~~~~~~~~~~~~~~~~~ /var/lib/dkms/anbox-binder/1/build/binder.c:3486:41: error: passing argument 1 of ‘security_release_secctx’ from incompatible pointer type [-Werror=incompatible-pointer-types] 3486 | security_release_secctx(secctx, secctx_sz); | ^~~~~~ | | | char * In file included from /var/lib/dkms/anbox-binder/1/build/binder.c:63: ./include/linux/security.h:595:49: note: expected ‘struct lsmcontext *’ but argument is of type ‘char *’ 595 | void security_release_secctx(struct lsmcontext *cp); | ~~~~~~~~~~~~~~~~~~~^~ /var/lib/dkms/anbox-binder/1/build/binder.c:3486:17: error: too many arguments to function ‘security_release_secctx’ 3486 | security_release_secctx(secctx, secctx_sz); | ^~~~~~~~~~~~~~~~~~~~~~~ In file included from /var/lib/dkms/anbox-binder/1/build/binder.c:63: ./include/linux/security.h:595:6: note: declared here 595 | void security_release_secctx(struct lsmcontext *cp); | ^~~~~~~~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors make[2]: *** [scripts/Makefile.build:281:/var/lib/dkms/anbox-binder/1/build/binder.o] 错误 1

Catiks avatar Nov 15 '21 13:11 Catiks

Any chance to look at @Catiks problem ? I had the exactly same issue on ubuntu 21.10. Maybe something related to https://patchwork.kernel.org/project/linux-nfs/patch/[email protected]/ ?

Vnzq4Qje3zzU avatar Dec 11 '21 18:12 Vnzq4Qje3zzU

Hello @enz0nun3s15 and @Catiks ,

to me it looks like you are trying to compile anbox-modules even though binder and ashmem are already compiled with your kernel. But anbox-modules are intended only for the corner case that the kernel of your distribution doesn't include binder and ashmem already. Ubuntu 21.10 and also earlier versions include binder and ashmem in their kernel image, so no need to use anbox-modules.

Best regards,

Christian

choff avatar Dec 11 '21 18:12 choff

Actually I was trying to install it in a server with ubuntu server with custom kernel which hasn't the binder installed - there is no /lib/modules/5.13.0-22-X/kernel/drivers/android/ (I tried both Azure and Oracle). Any idea of how to handle it ?

Vnzq4Qje3zzU avatar Dec 11 '21 23:12 Vnzq4Qje3zzU

Hello @enz0nun3s15 ,

binder and ashmem are not compiled as kernel modules anymore. Instead, they are built into the main kernel (vmlinux). Therefore, you cannot find binder and ashmem under drivers/android. The only way to check if you kernel has binder and ashmem is to check the kernel config. I suppose that is the case, both because of the error message you see when compiling anbox-modules and then also because you are running Ubuntu (where the default kernel comes with binder and ashmem).

Best regards,

Christian

choff avatar Dec 12 '21 15:12 choff

Actually I was trying to install it in a server with ubuntu server with custom kernel which hasn't the binder installed - there is no /lib/modules/5.13.0-22-X/kernel/drivers/android/ (I tried both Azure and Oracle). Any idea of how to handle it ?

If you are trying to use anbox try this anbox command: anbox system-info | grep -E 'name|version|binder|ashmem'

output should be printing something like this: binder: true ashmem: true

best regards SI

SoulInfernoDE avatar Dec 25 '21 09:12 SoulInfernoDE

Managed to build ashmem but got error on binder.

DKMS make.log for anbox-binder-1 for kernel 5.13.0-1028-oracle (aarch64) Mon Jun 20 07:33:45 UTC 2022 make -C /lib/modules/5.13.0-1028-oracle/build V=0 M=$PWD make[1]: Entering directory '/usr/src/linux-headers-5.13.0-1028-oracle' CC [M] /var/lib/dkms/anbox-binder/1/build/deps.o CC [M] /var/lib/dkms/anbox-binder/1/build/binder.o CC [M] /var/lib/dkms/anbox-binder/1/build/binder_alloc.o CC [M] /var/lib/dkms/anbox-binder/1/build/binderfs.o In file included from ././include/linux/kconfig.h:5, from : ./include/generated/autoconf.h:5107: warning: "CONFIG_ANDROID_BINDER_DEVICES" redefined 5107 | #define CONFIG_ANDROID_BINDER_DEVICES "" | In file included from ././include/linux/kconfig.h:5, from : ./include/generated/autoconf.h:5107: warning: "CONFIG_ANDROID_BINDER_DEVICES" redefined 5107 | #define CONFIG_ANDROID_BINDER_DEVICES "" | : note: this is the location of the previous definition : note: this is the location of the previous definition In file included from ././include/linux/kconfig.h:5, from : ./include/generated/autoconf.h:5107: warning: "CONFIG_ANDROID_BINDER_DEVICES" redefined 5107 | #define CONFIG_ANDROID_BINDER_DEVICES "" | : note: this is the location of the previous definition In file included from ././include/linux/kconfig.h:5, from : ./include/generated/autoconf.h:5107: warning: "CONFIG_ANDROID_BINDER_DEVICES" redefined 5107 | #define CONFIG_ANDROID_BINDER_DEVICES "" | : note: this is the location of the previous definition /var/lib/dkms/anbox-binder/1/build/binder.c: In function ‘binder_transaction’: /var/lib/dkms/anbox-binder/1/build/binder.c:3125:41: error: passing argument 2 of ‘security_task_getsecid_obj’ from incompatible pointer type [-Werror=incompatible-pointer-types] 3125 | security_task_getsecid_obj(proc->tsk, &secid); | ^~~~~~ | | | u32 * {aka unsigned int *} In file included from /var/lib/dkms/anbox-binder/1/build/binder.c:63: ./include/linux/security.h:545:72: note: expected ‘struct lsmblob *’ but argument is of type ‘u32 *’ {aka ‘unsigned int *’} 545 | void security_task_getsecid_obj(struct task_struct *p, struct lsmblob *blob); | ~~~~~~~~~~~~~~~~^~~~ /var/lib/dkms/anbox-binder/1/build/binder.c:3129:41: error: passing argument 2 of ‘security_secid_to_secctx’ from incompatible pointer type [-Werror=incompatible-pointer-types] 3129 | ret = security_secid_to_secctx(secid, &secctx, &secctx_sz); | ^~~~~~~ | | | char ** In file included from /var/lib/dkms/anbox-binder/1/build/binder.c:63: ./include/linux/security.h:591:71: note: expected ‘struct lsmcontext *’ but argument is of type ‘char **’ 591 | int security_secid_to_secctx(struct lsmblob *blob, struct lsmcontext *cp, | ~~~~~~~~~~~~~~~~~~~^~ /var/lib/dkms/anbox-binder/1/build/binder.c:3178:27: error: passing argument 1 of ‘security_release_secctx’ from incompatible pointer type [-Werror=incompatible-pointer-types] 3178 | security_release_secctx(secctx, secctx_sz); | ^~~~~~ | | | char * In file included from /var/lib/dkms/anbox-binder/1/build/binder.c:63: ./include/linux/security.h:595:49: note: expected ‘struct lsmcontext *’ but argument is of type ‘char *’ 595 | void security_release_secctx(struct lsmcontext *cp); | ~~~~~~~~~~~~~~~~~~~^~ /var/lib/dkms/anbox-binder/1/build/binder.c:3178:3: error: too many arguments to function ‘security_release_secctx’ 3178 | security_release_secctx(secctx, secctx_sz); | ^~~~~~~~~~~~~~~~~~~~~~~ In file included from /var/lib/dkms/anbox-binder/1/build/binder.c:63: ./include/linux/security.h:595:6: note: declared here 595 | void security_release_secctx(struct lsmcontext *cp); | ^~~~~~~~~~~~~~~~~~~~~~~ /var/lib/dkms/anbox-binder/1/build/binder.c:3513:27: error: passing argument 1 of ‘security_release_secctx’ from incompatible pointer type [-Werror=incompatible-pointer-types] 3513 | security_release_secctx(secctx, secctx_sz); | ^~~~~~ | | | char * In file included from /var/lib/dkms/anbox-binder/1/build/binder.c:63: ./include/linux/security.h:595:49: note: expected ‘struct lsmcontext *’ but argument is of type ‘char *’ 595 | void security_release_secctx(struct lsmcontext *cp); | ~~~~~~~~~~~~~~~~~~~^~ /var/lib/dkms/anbox-binder/1/build/binder.c:3513:3: error: too many arguments to function ‘security_release_secctx’ 3513 | security_release_secctx(secctx, secctx_sz); | ^~~~~~~~~~~~~~~~~~~~~~~ In file included from /var/lib/dkms/anbox-binder/1/build/binder.c:63: ./include/linux/security.h:595:6: note: declared here 595 | void security_release_secctx(struct lsmcontext *cp); | ^~~~~~~~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors make[2]: *** [scripts/Makefile.build:281: /var/lib/dkms/anbox-binder/1/build/binder.o] Error 1 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [Makefile:1879: /var/lib/dkms/anbox-binder/1/build] Error 2 make[1]: Leaving directory '/usr/src/linux-headers-5.13.0-1028-oracle' make: *** [Makefile:8: all] Error 2

datsoy avatar Jun 20 '22 07:06 datsoy

It is very likely that you are seeing these errors because binder is already part of your current kernel. In that case, you don't have to (and should not!) compile binder from anbox-modules. Please check your kernel config to confirm. anbox-modules is intended only for the case that your distribution provides a kernel that doesn't enable ashmem and binder.

chrihoff avatar Jun 20 '22 08:06 chrihoff

I tried building it but throws ERROR: modpost: "kallsyms_lookup_name" officially.

So I tried your fork to build.

heres a result of grep of "BINDER" in my current kernel config

CONFIG_ANDROID_BINDER_IPC=m CONFIG_ANDROID_BINDERFS=m CONFIG_ANDROID_BINDER_DEVICES=""

CONFIG_ANDROID_BINDER_IPC_SELFTEST is not set

Thanks.

datsoy avatar Jun 20 '22 09:06 datsoy

Thanks and that proves that you already have Binder. You can ignore "BINDER_IPC_SELFTEST" as that is just for debugging. The important think is that "BINDER_IPC" and "BINDERFS" are set. As they are compiled as kernel modules (since the value of the options is 'm'), you have to load these kernel modules with 'modprobe' before you can use them.

I assume that you also have ashmem support in your kernel since Binder and Ashmem are usually enabled together. So, there should be no reason for you to use anbox-modules.

chrihoff avatar Jun 20 '22 10:06 chrihoff

Thank you. When I try sudo modprobe binder_linux and ashmem It throws a modprobe: FATAL: Module binder_linux not found in directory /lib/modules/5.13.0-1028-oracle

datsoy avatar Jun 20 '22 10:06 datsoy

You are welcome :-)

This is a strange error message - clearly, your kernel was built with binder, so you should be able to load it. Maybe you are missing an RPM / Debian package that contains these extra kernel modules; that would be the only obvious explanation I have. If that doesn't help, I'm afraid you'll have to ask your distribution maintainers for advice.

chrihoff avatar Jun 20 '22 11:06 chrihoff

Yeah I think so too, maybe it was removed or wahtever purposely by oracle. Ill try to built a kernel if possible or roll back to 18.04. Thanks again. Cheers.

datsoy avatar Jun 20 '22 11:06 datsoy

Thank you. When I try sudo modprobe binder_linux and ashmem It throws a modprobe: FATAL: Module binder_linux not found in directory /lib/modules/5.13.0-1028-oracle

Are you sure that it is in your kernel as a module? ..as far as i know module compatibility for the android section has been removed in newer kernels! If it is build as module i guess it should be already loaded in your kernel without the module way.

Can you check the output of:

ls -1 /dev/{ashmem,binder} && uname -a image

Are you using this kernel ?: https://github.com/oracle/linux-uek

SoulInfernoDE avatar Jun 20 '22 14:06 SoulInfernoDE

@SoulInfernoDE , you are right; I forgot. In newer kernels (and I think this includes version 5.13), binder cannot be built as a kernel module anymore as it uses functions from the Linux kernel that are not available to kernel modules. So, probably binder and ashmem are compiled into your kernel. You can try to check /dev/ashmem and mount binderfs to double check.

chrihoff avatar Jun 20 '22 15:06 chrihoff

Hello, and thank you.

This is the output of ls -1 /dev/{ashmem,binder} && uname -a

ls: cannot access '/dev/ashmem': No such file or directory ls: cannot access '/dev/binder': No such file or directory Linux a1-instance 5.13.0-1028-oracle #33~20.04.1-Ubuntu SMP Mon May 2 03:56:22 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

No, Its the kernel that come off with oracles ubuntu os for their vps.

datsoy avatar Jun 20 '22 23:06 datsoy