Skip to contentSkip to conversation

Help in loading modules

DISCUSSION Julia Lawall 3 participants 6 messages Mar 11, 2023 – Mar 21, 2023 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20230311085922.GC11242@ubuntu

#1 lore raw
Quoted 4 lines · Sumitra Sharma

Hi julia,

My module pi433 is not present int the "lsmod" output. What should I suppose to do next.

Maybe it is not compiled by your kernel configuration?

Please include the list in any messages.

julia

Quoted 18 lines

##

Module                  Size  Used by
psmouse               204800  0
hid_generic            16384  0
mptspi                 24576  1
scsi_transport_spi     40960  1 mptspi
mptscsih               49152  1 mptspi
mptbase               114688  2 mptspi,mptscsih
e1000                 172032  0
ahci                   49152  0
libahci                57344  1 ahci
i2c_piix4              28672  0
pata_acpi              16384  0
usbhid                 73728  0
hid                   163840  2 usbhid,hid_generic
#2 lore raw

More information:

Upon running the "dmesg" it shows
##
BPF: Invalid name_offset:2154618

[ 2905.429687] failed to validate module [pi433] BTF: -22

##

Also I checked under "/lib/modules/uname -r" in the "modules.dep" file it do contains the "kernel/drivers/staging/pi433/pi433.ko:".

I also tried running "sudo insmod ./kernel/drivers/staging/pi433/pi433.ko" which again prints the error:

##
insmod: ERROR: could not insert module ./kernel/drivers/staging/pi433/pi433.ko: Invalid parameters ##

Other than these I also checked the ".config" which contains:

##
CONFIG_SPI=y
CONFIG_STAGING=y
CONFIG_PI433=m
##

where the module dependencies were given as

Symbol: PI433 [=m]                                                                                               │  
  │ Type  : tristate                                                                                                 │  
  │ Defined at drivers/staging/pi433/Kconfig:2                                                                       │  
  │   Prompt: Pi433 - a 433MHz radio module for Raspberry Pi                                                         │  
  │   Depends on: STAGING [=y] && SPI [=y]                                                                           │  
  │   Location:                                                                                                      │  
  │     -> Device Drivers                                                                                            │  
  │       -> Staging drivers (STAGING [=y])                                                                          │  
  │ (1)     -> Pi433 - a 433MHz radio module for Raspberry Pi (PI433 [=m])  
#3 lore raw
Quoted 26 lines · Sumitra Sharma

More information:

Upon running the "dmesg" it shows
##
BPF: Invalid name_offset:2154618

[ 2905.429687] failed to validate module [pi433] BTF: -22

##

Also I checked under "/lib/modules/uname -r" in the "modules.dep" file it do contains the "kernel/drivers/staging/pi433/pi433.ko:".

I also tried running "sudo insmod ./kernel/drivers/staging/pi433/pi433.ko" which again prints the error:

##
insmod: ERROR: could not insert module ./kernel/drivers/staging/pi433/pi433.ko: Invalid parameters ##

Other than these I also checked the ".config" which contains:

##
CONFIG_SPI=y
CONFIG_STAGING=y
CONFIG_PI433=m
##

where the module dependencies were given as

Quoted 9 lines
Symbol: PI433 [=m]                                                                                               │
  │ Type  : tristate                                                                                                 │
  │ Defined at drivers/staging/pi433/Kconfig:2                                                                       │
  │   Prompt: Pi433 - a 433MHz radio module for Raspberry Pi                                                         │
  │   Depends on: STAGING [=y] && SPI [=y]                                                                           │
  │   Location:                                                                                                      │
  │     -> Device Drivers                                                                                            │
  │       -> Staging drivers (STAGING [=y])                                                                          │
  │ (1)     -> Pi433 - a 433MHz radio module for Raspberry Pi (PI433 [=m])

Maybe it is not possible to install the module if you don't have the device. For staging code, it is likely only possible to verify that it compiles properly.

julia

#4 lore raw
In reply to Sumitra Sharma
Quoted 7 lines · Sumitra Sharma

More information:

Upon running the "dmesg" it shows
##
BPF: Invalid name_offset:2154618

[ 2905.429687] failed to validate module [pi433] BTF: -22

##

Good start. I did some digging.

$ git grep "failed to validate module"
kernel/bpf/btf.c:                               pr_warn("failed to validate module [%s] BTF: %ld\n",

kernel/bpf/btf.c:
...

                        if (!IS_ENABLED(CONFIG_MODULE_ALLOW_BTF_MISMATCH)) {
                                pr_warn("failed to validate module [%s] BTF: %ld\n",
                                        mod->name, PTR_ERR(btf));
                                err = PTR_ERR(btf);
			} else {

...

$ git grep BTF_MISMATCH
kernel/bpf/btf.c:               if (env->btf->base_btf && IS_ENABLED(CONFIG_MODULE_ALLOW_BTF_MISMATCH))
kernel/bpf/btf.c:               if (env->btf->base_btf && IS_ENABLED(CONFIG_MODULE_ALLOW_BTF_MISMATCH))
kernel/bpf/btf.c:                       if (!IS_ENABLED(CONFIG_MODULE_ALLOW_BTF_MISMATCH)) {
lib/Kconfig.debug:config MODULE_ALLOW_BTF_MISMATCH

lib/Kconfig.debug:
...
config MODULE_ALLOW_BTF_MISMATCH
bool "Allow loading modules with non-matching BTF type info" depends on DEBUG_INFO_BTF_MODULES
help
For modules whose split BTF does not match vmlinux, load without BTF rather than refusing to load. The default behavior with module BTF enabled is to reject modules with such mismatches; this option will still load module BTF where possible but ignore it when a mismatch is found.
...

For more information on BTF:

https://docs.kernel.org/bpf/btf.html

Are you building this module in the same place as the running kernel? It would probably be easier to do so.

Ira

Quoted 30 lines

Also I checked under "/lib/modules/uname -r" in the "modules.dep" file it do contains the "kernel/drivers/staging/pi433/pi433.ko:".

I also tried running "sudo insmod ./kernel/drivers/staging/pi433/pi433.ko" which again prints the error:

##
insmod: ERROR: could not insert module ./kernel/drivers/staging/pi433/pi433.ko: Invalid parameters ##

Other than these I also checked the ".config" which contains:

##
CONFIG_SPI=y
CONFIG_STAGING=y
CONFIG_PI433=m
##

where the module dependencies were given as

Symbol: PI433 [=m]                                                                                               │  
  │ Type  : tristate                                                                                                 │  
  │ Defined at drivers/staging/pi433/Kconfig:2                                                                       │  
  │   Prompt: Pi433 - a 433MHz radio module for Raspberry Pi                                                         │  
  │   Depends on: STAGING [=y] && SPI [=y]                                                                           │  
  │   Location:                                                                                                      │  
  │     -> Device Drivers                                                                                            │  
  │       -> Staging drivers (STAGING [=y])                                                                          │  
  │ (1)     -> Pi433 - a 433MHz radio module for Raspberry Pi (PI433 [=m])  
#5 lore raw
Quoted 45 lines · Ira Weiny
Quoted 7 lines · Sumitra Sharma

More information:

Upon running the "dmesg" it shows
##
BPF: Invalid name_offset:2154618

[ 2905.429687] failed to validate module [pi433] BTF: -22

##

Good start. I did some digging.

$ git grep "failed to validate module"
kernel/bpf/btf.c:                               pr_warn("failed to validate module [%s] BTF: %ld\n",

kernel/bpf/btf.c:
...

                        if (!IS_ENABLED(CONFIG_MODULE_ALLOW_BTF_MISMATCH)) {
                                pr_warn("failed to validate module [%s] BTF: %ld\n",
                                        mod->name, PTR_ERR(btf));
                                err = PTR_ERR(btf);
			} else {

...

$ git grep BTF_MISMATCH
kernel/bpf/btf.c:               if (env->btf->base_btf && IS_ENABLED(CONFIG_MODULE_ALLOW_BTF_MISMATCH))
kernel/bpf/btf.c:               if (env->btf->base_btf && IS_ENABLED(CONFIG_MODULE_ALLOW_BTF_MISMATCH))
kernel/bpf/btf.c:                       if (!IS_ENABLED(CONFIG_MODULE_ALLOW_BTF_MISMATCH)) {
lib/Kconfig.debug:config MODULE_ALLOW_BTF_MISMATCH

lib/Kconfig.debug:
...
config MODULE_ALLOW_BTF_MISMATCH
bool "Allow loading modules with non-matching BTF type info" depends on DEBUG_INFO_BTF_MODULES
help
For modules whose split BTF does not match vmlinux, load without BTF rather than refusing to load. The default behavior with module BTF enabled is to reject modules with such mismatches; this option will still load module BTF where possible but ignore it when a mismatch is found.
...

Quoted 9 lines

For more information on BTF:

https://docs.kernel.org/bpf/btf.html

Are you building this module in the same place as the running kernel? It would probably be easier to do so.

Ira

Hi Ira,

What is the solution to this?

Regards,

Sumitra

Quoted 32 lines
Quoted 30 lines

Also I checked under "/lib/modules/uname -r" in the "modules.dep" file it do contains the "kernel/drivers/staging/pi433/pi433.ko:".

I also tried running "sudo insmod ./kernel/drivers/staging/pi433/pi433.ko" which again prints the error:

##
insmod: ERROR: could not insert module ./kernel/drivers/staging/pi433/pi433.ko: Invalid parameters ##

Other than these I also checked the ".config" which contains:

##
CONFIG_SPI=y
CONFIG_STAGING=y
CONFIG_PI433=m
##

where the module dependencies were given as

Symbol: PI433 [=m]                                                                                               │  
  │ Type  : tristate                                                                                                 │  
  │ Defined at drivers/staging/pi433/Kconfig:2                                                                       │  
  │   Prompt: Pi433 - a 433MHz radio module for Raspberry Pi                                                         │  
  │   Depends on: STAGING [=y] && SPI [=y]                                                                           │  
  │   Location:                                                                                                      │  
  │     -> Device Drivers                                                                                            │  
  │       -> Staging drivers (STAGING [=y])                                                                          │  
  │ (1)     -> Pi433 - a 433MHz radio module for Raspberry Pi (PI433 [=m])  
#6 lore raw
Quoted 53 lines · Sumitra Sharma
Quoted 52 lines · Ira Weiny
Quoted 7 lines · Sumitra Sharma

More information:

Upon running the "dmesg" it shows
##
BPF: Invalid name_offset:2154618

[ 2905.429687] failed to validate module [pi433] BTF: -22

##

Good start. I did some digging.

$ git grep "failed to validate module"
kernel/bpf/btf.c:                               pr_warn("failed to validate module [%s] BTF: %ld\n",

kernel/bpf/btf.c:
...

                        if (!IS_ENABLED(CONFIG_MODULE_ALLOW_BTF_MISMATCH)) {
                                pr_warn("failed to validate module [%s] BTF: %ld\n",
                                        mod->name, PTR_ERR(btf));
                                err = PTR_ERR(btf);
			} else {

...

$ git grep BTF_MISMATCH
kernel/bpf/btf.c:               if (env->btf->base_btf && IS_ENABLED(CONFIG_MODULE_ALLOW_BTF_MISMATCH))
kernel/bpf/btf.c:               if (env->btf->base_btf && IS_ENABLED(CONFIG_MODULE_ALLOW_BTF_MISMATCH))
kernel/bpf/btf.c:                       if (!IS_ENABLED(CONFIG_MODULE_ALLOW_BTF_MISMATCH)) {
lib/Kconfig.debug:config MODULE_ALLOW_BTF_MISMATCH

lib/Kconfig.debug:
...
config MODULE_ALLOW_BTF_MISMATCH
bool "Allow loading modules with non-matching BTF type info" depends on DEBUG_INFO_BTF_MODULES
help
For modules whose split BTF does not match vmlinux, load without BTF rather than refusing to load. The default behavior with module BTF enabled is to reject modules with such mismatches; this option will still load module BTF where possible but ignore it when a mismatch is found.
...

For more information on BTF:

https://docs.kernel.org/bpf/btf.html

Are you building this module in the same place as the running kernel? It would probably be easier to do so.

Quoted 6 lines
Quoted 2 lines

Ira

Hi Ira,

What is the solution to this?

I don't have a solution, sorry. I'm hypothesising the issue is that the kernel and the module were built with different configurations.

So were you building the module with the same configuration?

In general it is a lot easier to rebuild and run the kernel from the source you are building from. But that is not strictly necessary. Hence my question.

Ira