Jump to content

Recommended Posts

Posted (edited)

I'm using this community maintained Bookworm image published for OrangePi Zero . I cannot unload this minimal kernel module for some reason.
Some information that could be useful:

`uname -a` output:

Linux orangepizero 6.12.23-current-sunxi #2 SMP Thu Apr 10 12:39:41 UTC 2025 armv7l GNU/Linux

`zcat /proc/config.gz | grep UNLOAD` output

CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
# CONFIG_MODULE_UNLOAD_TAINT_TRACKING is not set

 

Some information to replicate the issue:

install required packages:

sudo apt update && sudo apt upgrade

# reboot

sudo apt install build-essential linux-headers-current-sunxi -y

 

Source code:

#include <linux/module.h>
#include <linux/init.h>

static int __init on_init(void)
{
        return 0;
}

static void __exit on_exit(void)
{
}

module_init(on_init);
module_exit(on_exit);

MODULE_LICENSE("GPL");

Makefile:

obj-m += testmod.o



all:
        make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
        make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

 

Expected `dmesg` output after `insmod testmod.ko`

[53949.545615] testmod: loading out-of-tree module taints kernel.

After this if you run `lsmod` you will get this kernel oops message:

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.302533] Internal error: Oops: 5 [#1] SMP THUMB2

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.612164] Process lsmod (pid: 2851, stack limit = 0x73aba90f)

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.620054] Stack: (0xe08f5e08 to 0xe08f6000)

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.626381] 5e00:                   00000000 000000f8 00000000 00000000 00000000 00000000

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.638620] 5e20: 00000000 c56bddda 00000400 c66dbd70 00000000 e08f5eb0 bfac3044 00000000

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.650990] 5e40: c66dbd88 c0311685 e08f5e98 c66dbd98 c1770a80 00000001 00000001 c5296800

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.663548] 5e60: 181cd000 00000000 e08f5f80 c5f40600 00000000 00000400 01345ca0 00000001

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.676199] 5e80: c0b21784 c0311a1d 00000400 00000001 01345ca0 00000400 00000001 00000000

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.689004] 5ea0: e08f5e90 00000400 00000001 00000000 c5f40600 00000000 00000000 00000000

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.702080] 5ec0: 00000000 00000000 00000000 00000000 00000000 00000000 c035b961 c56bddda

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.715223] 5ee0: c035b961 c5f40600 c533d000 00000400 e08f5f80 c02ed1d5 00001a55 c9b58048

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.728467] 5f00: c9b58048 00000000 00000000 00000000 c57c1518 d92c5738 00000000 c56bddda

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.741711] 5f20: 00000000 e08f5fb0 013460a4 00000817 c533d000 00000255 c3f58300 c0ae8f5d

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.754958] 5f40: 00000000 c0ae8f5d 00000000 00000000 00000000 c56bddda 00000000 c5f40600

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.768295] 5f60: c5f40600 00000000 00000000 c01002a0 c533d000 00000003 00000000 c02eda4b

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.781696] 5f80: 00000000 00000000 c01002a0 c56bddda be960270 013442e0 000005e8 b6c2c888

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.795333] 5fa0: 00000003 c0100061 013442e0 000005e8 00000003 01345ca0 00000400 00000001

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.809033] 5fc0: 013442e0 000005e8 b6c2c888 00000003 0000000a be9603c4 00000000 00000000

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.822834] 5fe0: 00000003 be9602f0 b6bc737b b6b40656 40070030 00000003 00000000 00000000

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.836685] Call trace: 

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.836703]  m_show from seq_read_iter+0xa1/0x384
Segmentation fault

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.849448]  seq_read_iter from seq_read+0xb5/0xdc

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.856938]  seq_read from vfs_read+0x75/0x228

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.864024]  vfs_read from ksys_read+0x53/0xa8
xch@orangepizero:~/dev/driver/testmod$ 
Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.871048]  ksys_read from ret_fast_syscall+0x1/0x5c

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.878636] Exception stack(0xe08f5fa8 to 0xe08f5ff0)

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.886166] 5fa0:                   013442e0 000005e8 00000003 01345ca0 00000400 00000001

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.899234] 5fc0: 013442e0 000005e8 b6c2c888 00000003 0000000a be9603c4 00000000 00000000

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.912280] 5fe0: 00000003 be9602f0 b6bc737b b6b40656

Message from syslogd@orangepizero at Apr 20 17:27:43 ...
 kernel:[54313.919751] Code: f24c 787c f2cc 08d8 (6922) 4641

 

And then calling `rmmod testmod.ko` will lock the command line forever.

 

Same exact module can be loaded/unloaded with no issue on the x86 host PC with 6.8.0-58-generic kernel.

Edited by xch
Fix typo

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines