Re: [lkp] [x86] 784d5699ed: kmsg.ip_tables:no_symbol_version_for_copy_from_user

From: Mathieu OTHACEHE
Date: Fri Oct 14 2016 - 03:29:48 EST



Hi Michal,

Sorry for late reply. My toolchain in arch linux gcc version 6.2.1
20160830. I used defconfig (x86_64), with CONFIG_MODVERSIONS=y.

I'm understanding better what's happening here. Running:

nm arch/x86/lib/clear_page_64.o
gives,
0000000000000000 T clear_page
0000000000000050 T clear_page_c_e
0000000000000010 T clear_page_orig
w __crc_clear_page
0000000000000000 r __kcrctab_clear_page
0000000000000000 r __kstrtab_clear_page
0000000000000000 R __ksymtab_clear_page

but running

nm vmlinux|grep __crc_clear_page
gives,
0000000051fac2d3 A __crc_clear_page_dirty_for_io

So the weak symbol "__crc_clear_page" is not copied in vmlinux during
linking. modpost uses __crc_* symbols to extract crc. Not founding
those crc, it doesn't include symbols in mod.c modversion_info struct.

It seems to be a linker bug. I also tested linking:
<main.c>
int main() {
return 0;
}

and
<test.S>
.section test,"a"
__kcrctab_test:
.quad __test
.weak __test

Linking main.o and test.o,
* weak symbol "__test" appears in a.out with gcc 5.4.0
* weak symbol "__test" *does not* appear in a.out with gcc 6.2.1

I'll try to find if there is a related bug report in gcc.

Thanks,

Mathieu