Re: kernel modules failing to load because of missing symbols


Tim Harvey
 

On Mon, May 15, 2017 at 11:00 AM, Tim Harvey <tharvey@...> wrote:
Greetings,

I've got a kernel recipe that builds several kernel modules which get
build and packaged as kernel-module-<modname>. I'm finding that while
most of these modules appear to load properly into the kernel at
runtime, several of them do not because of missing symbols:

# modprobe bluetooth
[ 782.848396] bluetooth: no symbol version for sock_register
[ 782.854315] bluetooth: Unknown symbol sock_register (err -22)
# modprobe ip_tables
[ 893.675147] ip_tables: no symbol version for ns_capable
[ 893.680385] ip_tables: Unknown symbol ns_capable (err -22)
modprobe: ERROR: could not insert 'ip_tables': Invalid argument

The symbols do appear to be in the kernel's System.map:
# grep " ns_capable" /boot/System.map*
80033cfc T ns_capable
# grep sock_register /boot/System.map*
805337a8 T sock_register
8084fb0c R __ksymtab_sock_register
8085ab64 r __kcrctab_sock_register
8087abaf r __kstrtab_sock_register

I'm seeing this on Yocto master, Yocto pyro 2.3, Yocto morty 2.2 but
surprisingly not on Yocto krogoth 2.1.
In case anyone else runs into this I found that the issue was
occurring for a 3.14 kernel built with a GCC 5.4+ toolchain (GCC 5.2
is ok, GCC 5.3 was untested) due to a failure to calculate the CRC for
various modules by the kernel build tool scripts/genksysms. The kernel
build in this case 'will' show warnings such as:

WARNING: "ns_capable" [net/ipv6/netfilter/ip6_tables.ko] has no CRC!
WARNING: "ns_capable" [net/ipv4/netfilter/ip_tables.ko] has no CRC!
WARNING: "sock_register" [net/bluetooth/bluetooth.ko] has no CRC!
WARNING: "inode_add_bytes" [fs/udf/udf.ko] has no CRC!
WARNING: "current_fs_time" [fs/udf/udf.ko] has no CRC!
WARNING: "do_sync_read" [fs/udf/udf.ko] has no CRC!
WARNING: "d_tmpfile" [fs/udf/udf.ko] has no CRC!
WARNING: "vfs_fsync_range" [fs/udf/udf.ko] has no CRC!
WARNING: "in_group_p" [fs/configfs/configfs.ko] has no CRC!
WARNING: "current_fs_time" [fs/binfmt_misc.ko] has no CRC!
WARNING: "sys_close" [fs/binfmt_misc.ko] has no CRC!

The resulting modules with the warnings above will fail to load due to
those missing symbols. The issue is resolved by kernel commit
dc53324060f32 [1] which appears in Linux 3.15 and patches genksyms.

Tim

[1] - https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/scripts/genksyms?id=dc53324060f324e8af6867f57bf4891c13c6ef18

Join meta-freescale@lists.yoctoproject.org to automatically receive all group messages.