Re: When adding a module, what does "Exec format error" / "Skipping invalid relocation target" mean, and how to fix it?
From: Luis Chamberlain <mcgrof@kernel.org>
Date: 2023-01-20 00:08:32
On Tue, Jan 17, 2023 at 05:42:38PM -0700, Chandler Sobel-Sorenson wrote:
# modprobe -v qat_c62x insmod /lib/modules/4.19.0-5-amd64/updates/drivers/crypto/qat/qat_common/intel_qat.ko modprobe: ERROR: could not insert 'qat_c62x': Exec format error # modprobe -v intel_qat insmod /lib/modules/4.19.0-5-amd64/updates/drivers/crypto/qat/qat_common/intel_qat.ko modprobe: ERROR: could not insert 'intel_qat': Exec format error
As of v5.10 we now have merged commit 14721add58ef267344bee254bc276c9139b7b665
("module: Add more error message for failed kernel module loading")
which helps expand on this being more friendly:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=14721add58ef267344bee254bc276c9139b7b665
# Meanwhile, the system log shows: <date> <host> kernel: [<uptime>] module: x86/modules: Skipping invalid relocation target, existing value is nonzero for type 1, loc 000000005c09d38d, val ffffffffc09ba2fe <date> <host> kernel: [<uptime>] module: x86/modules: Skipping invalid relocation target, existing value is nonzero for type 1, loc 00000000690eef73, val ffffffffc0b572fe <date> <host> kernel: [<uptime>] module: x86/modules: Skipping invalid relocation target, existing value is nonzero for type 1, loc 000000007d30ad16, val ffffffffc0c862fe <date> <host> kernel: [<uptime>] module: x86/modules: Skipping invalid relocation target, existing value is nonzero for type 1, loc 00000000671d2da7, val ffffffffc0cd82fe <date> <host> kernel: [<uptime>] module: x86/modules: Skipping invalid relocation target, existing value is nonzero for type 1, loc 0000000072877855, val ffffffffc0d2a2fe What are these errors even talking about, what is the cause, and possible solutions? Thanks so much!
That's from apply_relocate_add(). The locs are supposed to be 0 and they are not so it bails. That relocation type is 1 so R_X86_64_64. https://en.wikipedia.org/wiki/Relocation_(computing) Did you really build the module yourself? It doesn't even seem you have kernel headers. Luis