Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add binder and ashmem kernel modules #173

Closed
SkyfallWasTaken opened this issue Aug 24, 2022 · 11 comments
Closed

Add binder and ashmem kernel modules #173

SkyfallWasTaken opened this issue Aug 24, 2022 · 11 comments

Comments

@SkyfallWasTaken
Copy link

Most Ubuntu-based distros ship the binder and ashmem kernel modules. However, Pop!_OS does not. These modules are required for Android emulators, such as Anbox (which requires binder and ashmem) and Waydroid (which only requires binder). I did find two issues about this (#113 and #39) but they suggest installing a new kernel, which I don't really feel comfortable with.

@Fuseteam
Copy link

considering upstream dropped ashmem in favor of memfd since 5.18, i think people shouldn't use anbox anymore. So just binderfs should be enough

@Fuseteam
Copy link

@SkyfallWasTaken could you test 2 things for me?

@SkyfallWasTaken
Copy link
Author

@Fuseteam

can check if memfd is enabled with grep -E '(MEMFD)' /boot/config-$(uname -r)? feel free to share the output

image

can you check if these steps enable binder on pop-os?

No, sorry, it errors with this:

❯ ./installBinder
Cloning into 'binder-module'...
remote: Enumerating objects: 158, done.
remote: Counting objects: 100% (65/65), done.
remote: Compressing objects: 100% (42/42), done.
remote: Total 158 (delta 24), reused 42 (delta 15), pack-reused 93
Receiving objects: 100% (158/158), 189.42 KiB | 1.91 MiB/s, done.
Resolving deltas: 100% (44/44), done.
sudo: unable to resolve host hypex-pc: Name or service not known
[sudo] password for skyfall:
sudo: unable to resolve host hypex-pc: Name or service not known
sudo: unable to resolve host hypex-pc: Name or service not known
Creating symlink /var/lib/dkms/binder-linux/1/source -> /usr/src/binder-linux-1

Kernel preparation unnecessary for this kernel. Skipping...

Building module:
cleaning build area...(bad exit status: 2)
make -j8 KERNELRELEASE=6.0.2-76060002-generic all KERNEL_SRC=/lib/modules/6.0.2-76060002-generic/build.....(bad exit status: 2)
ERROR (dkms apport): binary package for binder-linux: 1 not found
Error! Bad return status for module build on kernel: 6.0.2-76060002-generic (x86_64)
Consult /var/lib/dkms/binder-linux/1/build/make.log for more information.

It's worth noting that Pop!_OS updates the kernel faster than Ubuntu does (It's on 6.0.2 now instead of the previous 5.18)

@Fuseteam
Copy link

that's fine that repo is a fork of one that is independent of distros, i might have messed up somewhere then hmmm

@Fuseteam
Copy link

ah i think i found it, @SkyfallWasTaken can you try git pull in your cloned directory and retry the steps?

assuming you didn't undo the changes, basically

cd binder-module
git pull
cp -rT binder /usr/src/binder-linux-1
dkms install binder-linux/1

@SkyfallWasTaken
Copy link
Author

Sorry, the dkms command has still got the same error:

❯ sudo dkms install binder-linux/1
sudo: unable to resolve host hypex-pc: Name or service not known

Kernel preparation unnecessary for this kernel. Skipping...

Building module:
cleaning build area...(bad exit status: 2)
make -j8 KERNELRELEASE=6.0.2-76060002-generic all KERNEL_SRC=/lib/modules/6.0.2-76060002-generic/build.....(bad exit status: 2)
ERROR (dkms apport): binary package for binder-linux: 1 not found
Error! Bad return status for module build on kernel: 6.0.2-76060002-generic (x86_64)
Consult /var/lib/dkms/binder-linux/1/build/make.log for more information.

@Fuseteam
Copy link

Fuseteam commented Oct 31, 2022

well darn it, i'll look deeper into it when i have the time

jackpot51 pushed a commit that referenced this issue Dec 13, 2022
[ Upstream commit 5d7bebf ]

If transport_add_device() fails in sas_phy_add(), the kernel will crash
trying to delete the device in transport_remove_device() called from
sas_remove_host().

Unable to handle kernel NULL pointer dereference at virtual address 0000000000000108
CPU: 61 PID: 42829 Comm: rmmod Kdump: loaded Tainted: G        W          6.1.0-rc1+ #173
pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : device_del+0x54/0x3d0
lr : device_del+0x37c/0x3d0
Call trace:
 device_del+0x54/0x3d0
 attribute_container_class_device_del+0x28/0x38
 transport_remove_classdev+0x6c/0x80
 attribute_container_device_trigger+0x108/0x110
 transport_remove_device+0x28/0x38
 sas_phy_delete+0x30/0x60 [scsi_transport_sas]
 do_sas_phy_delete+0x6c/0x80 [scsi_transport_sas]
 device_for_each_child+0x68/0xb0
 sas_remove_children+0x40/0x50 [scsi_transport_sas]
 sas_remove_host+0x20/0x38 [scsi_transport_sas]
 hisi_sas_remove+0x40/0x68 [hisi_sas_main]
 hisi_sas_v2_remove+0x20/0x30 [hisi_sas_v2_hw]
 platform_remove+0x2c/0x60

Fix this by checking and handling return value of transport_add_device()
in sas_phy_add().

Fixes: c7ebbbc ("[SCSI] SAS transport class")
Suggested-by: John Garry <john.g.garry@oracle.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20221107124828.115557-1-yangyingliang@huawei.com
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
@JamiKettunen
Copy link

ASHMEM was dropped from mainline kernel in 5.18, but BINDERFS appears to be enabled even on the v6.2 kernel of the 22.04-based live ISO. I think all needed Waydroid options are now enabled by default?

@Fuseteam
Copy link

@SkyfallWasTaken can you confirm?

@SkyfallWasTaken
Copy link
Author

@Fuseteam Unfortunately, I no longer use Linux, so I can't test this out. Sorry :(

@Fuseteam
Copy link

Ah no worries

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

No branches or pull requests

4 participants