morrownr / 88x2bu-20210702

Linux Driver for USB WiFi Adapters that are based on the RTL8812BU and RTL8822BU Chipsets - v5.13.1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

modpost/insmod issue

lgair opened this issue · comments

Hi,
I was able to build & utilize this driver for a target system Linux zynqmp 5.15.0-1019-xilinx-zynqmp #27 SMP Thu Sep 28 14:54:32 PDT 2023 aarch64 aarch64 aarch64 GNU/Linux about a month and a half ago, however I need to run it on a newer kernel version (from xilinx) Linux zynqmp 5.15.0-1023-xilinx-zynqmp #27 SMP Thu Sep 28 14:54:32 PDT 2023 aarch64 aarch64 aarch64 GNU/Linux
I am able to build and compile the driver using both manual make methods & the install-driver.sh script.
However when inserting the 88x2bu.ko driver with both insmod or modpost I recieve a segfault error and it soft bricks the system, lsmod, modpost & insmod all hang, and I am unable to remove the module from the kernel (at the moment the only way I know how to fix this is to restore the whole image from a backup I have). edit: for non dkms installations remove-driver.sh works and resolves the system issues.

distro for for the system is ubuntu 22.04

install-driver.sh dump:

root@zynqmp:~/88x2bu-20210702# ./install-driver.sh 
: ---------------------------
: install-driver.sh v20231115
: aarch64 (kernel architecture)
: arm64 (architecture to send to gcc)
: 4/4 (in-use/total processing units)
: 1906528 (total system memory)
: 5.15.0-1023-xilinx-zynqmp (kernel version)
: gcc (version of gcc used to compile the kernel)
: gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
: dkms-2.8.7
: mokutil not installed
: ---------------------------

Checking for previously installed drivers...
Finished checking for and removing previously installed drivers.
: ---------------------------

Starting installation.
Installing 88x2bu.conf to /etc/modprobe.d
The dkms installation routines are in use.
Copying source files to /usr/src/rtl88x2bu-5.13.1
Creating symlink /var/lib/dkms/rtl88x2bu/5.13.1/source -> /usr/src/rtl88x2bu-5.13.1
The driver was added to dkms successfully.
: ---------------------------


Kernel preparation unnecessary for this kernel. Skipping...

Building module:
cleaning build area...
./dkms-make.sh.................................................................................................
cleaning build area...
Compile time: 976.99 seconds
The driver was built by dkms successfully.
: ---------------------------

88x2bu.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.15.0-1023-xilinx-zynqmp/updates/dkms/

depmod..............
The driver was installed by dkms successfully.
: ---------------------------

Info: Update this driver with the following commands as needed:

$ git pull
$ sudo sh install-driver.sh

Note: Updates to this driver SHOULD be performed before distro
      upgrades such as Ubuntu 23.10 to 24.04.
Note: Updates can be performed as often as you like. It is
      recommended to update at least every 2 months.
Note: Work on this driver, like the Linux kernel, is continuous.

Enjoy!

Do you want to edit the driver options file now? (recommended) [Y/n] n
Do you want to apply the new options by rebooting now? (recommended) [Y/n] n

Here's the dmesg log from one of my attempts:

zynqmp login: [ 1251.633023] Unable to handle kernel paging request at virtual address 97fffff495edc506
[ 1251.640991] Mem abort info:
[ 1251.643771]   ESR = 0x96000004
[ 1251.646827]   EC = 0x25: DABT (current EL), IL = 32 bits
[ 1251.652142]   SET = 0, FnV = 0
[ 1251.655186]   EA = 0, S1PTW = 0
[ 1251.658322]   FSC = 0x04: level 0 translation fault
[ 1251.663201] Data abort info:
[ 1251.666144]   ISV = 0, ISS = 0x00000004
[ 1251.670003]   CM = 0, WnR = 0
[ 1251.672989] [97fffff495edc506] address between user and kernel address ranges
[ 1251.680132] Internal error: Oops: 96000004 [#1] SMP
[ 1251.684998] Modules linked in: 88x2bu(OE+) cfg80211 tls binfmt_misc edt_ft5x06 mali zynqmp_r5_remoteproc uio_pdrv_genirq sch_fq_codel dm_multipath scsi_dh_rdac scsi_dh_emc scsi_dh_alua dmaproxy efi_pstore ipr
[ 1251.728264] CPU: 3 PID: 16823 Comm: modprobe Tainted: G           OE     5.15.0-1019-xilinx-zynqmp #21
[ 1251.737559] Hardware name: ZynqMP ZCU104 RevC (DT)
[ 1251.742335] pstate: 20400005 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 1251.749287] pc : mod_sysfs_setup+0x234/0x370
[ 1251.753549] lr : mod_sysfs_setup+0x204/0x370
[ 1251.757811] sp : ffff800010873b10
[ 1251.761110] x29: ffff800010873b10 x28: 0000000000000008 x27: 0000000000000007
[ 1251.768237] x26: ffff800001b13130 x25: ffff800010873ca0 x24: ffff800001b12e18
[ 1251.775364] x23: ffff800001b12e50 x22: 0000000000000000 x21: ffff800001a20d40
[ 1251.782491] x20: 0000000000000000 x19: ffff800001b12e00 x18: 0000000000000000
[ 1251.789618] x17: ffff000800e6b9f0 x16: 0000000000000068 x15: ffff000805dd7e70
[ 1251.796745] x14: ffff000805dd7e30 x13: ffff00087f820f80 x12: 0000000000000006
[ 1251.803872] x11: ffff80000a9f77a0 x10: 0000000000000000 x9 : ffff8000095a90cc
[ 1251.810999] x8 : 0101010101010101 x7 : 7f7f7f7f7f7f7f7f x6 : 736877645e727872
[ 1251.818126] x5 : ffff00080b234d19 x4 : 0000000000000000 x3 : 0000000000000000
[ 1251.825253] x2 : ffff800001b12e18 x1 : ffff800001b12e50 x0 : 97fffff495edc43e
[ 1251.832381] Call trace:
[ 1251.834812]  mod_sysfs_setup+0x234/0x370
[ 1251.838726]  load_module+0x978/0xb20
[ 1251.842294]  __do_sys_finit_module+0xa8/0x114
[ 1251.846643]  __arm64_sys_finit_module+0x28/0x3c
[ 1251.851166]  invoke_syscall+0x78/0x100
[ 1251.854907]  el0_svc_common.constprop.0+0x54/0x184
[ 1251.859690]  do_el0_svc+0x30/0x9c
[ 1251.862997]  el0_svc+0x28/0xb0
[ 1251.866044]  el0t_64_sync_handler+0xa4/0x130
[ 1251.870306]  el0t_64_sync+0x1a4/0x1a8
[ 1251.873966] Code: 540005c0 f94016a0 aa1803e2 aa1703e1 (f9406400) 
[ 1251.880050] ---[ end trace b6f20a3fb1cb3d2b ]---

I've tried returning to an older version of the kernel but now the same thing is happening on Linux zynqmp 5.15.0-1019-xilinx-zynqmp as well.

Steps I take to build the driver on my target system:

sudo apt-get install flex bison dkms iw linux-headers-$(uname -r)
cd /lib/modules/$(uname -r)/build
sudo make clean
sudo make headers_install
# Modify build/scripts/Makefile to exclude selenux subdir, & sign-file,extract-cert, insert-sys-cert, extract-cert, #sorttable scripts as they are missing header files in aarch64 or headers used to build them are no longer #supported in 5.15.0 (such as classmap.h etc)
sudo make scripts # recompile scripts I need from x86 -> aarch64
cd
git clone https://github.com/morrownr/88x2bu-20210702
cd 88x2bu-20210702
sudo make -j$(nproc)
sudo make install
#cfg82011 module usually conflicts with new headers, and 88x2bu module does not know which module to use, results in unk symbol errors
# to correct:
find /lib/modules -name cfg80211.ko -ls
sudo rm -rf  /lib/modules/5.15.0-1015-xilinx-zynqmp/kernel/net/wireless/cfg80211.ko
sudo modprobe cfg80211
sudo modprobe 88x2bu

Has anyone encountered this or something similar before?
I am unsure if this is a driver issue or if it is something i've done. Im pretty stumped.
Any help would be appreciated, Thanks!