Created attachment 23968 [details] [PATCH] modules: don't export section names of empty sections via sysfs On the parisc architecture _every_ kernel module brings up a kernel "badness warning" like the following one: sysfs: cannot create duplicate filename '/module/ac97_bus/sections/.text' ------------[ cut here ]------------ Badness at fs/sysfs/dir.c:487 IASQ: 00000000 00000000 IAOQ: 10204ff8 10204ffc IIR: 03ffe01f ISR: 00000000 IOR: 00000000 CPU: 0 CR30: 7ce58000 CR31: 11111111 ORIG_R28: 00000001 IAOQ[0]: sysfs_add_one+0xb8/0xd0 IAOQ[1]: sysfs_add_one+0xbc/0xd0 RP(r2): sysfs_add_one+0xb8/0xd0 Backtrace: [<102045b8>] sysfs_add_file_mode+0x60/0xc4 [<1020748c>] internal_create_group+0xf0/0x1d8 [<1016f0f0>] load_module+0x10e8/0x1294 Reason for that is, that on parisc we do have kernel modules with duplicate section names, e.g. multiple ".text" sections. An objdump on such a kernel module gives: Sections: Idx Name Size VMA LMA File off Algn 0 .note.gnu.build-id 00000024 00000000 00000000 00000034 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 1 .text 00000000 00000000 00000000 00000058 2**0 CONTENTS, ALLOC, LOAD, READONLY, CODE 2 .text.ac97_bus_match 0000001c 00000000 00000000 00000058 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE 3 .exit.text 00000030 00000000 00000000 00000074 2**2 CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE 4 .init.text 00000030 00000000 00000000 000000a4 2**2 CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE 5 .text 00000000 00000000 00000000 000000d4 2**0 CONTENTS, ALLOC, LOAD, READONLY, CODE 6 .rodata.str1.4 00000008 00000000 00000000 000000d4 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA ... As you can see, two ".text" sections are listed (due to usage of the -ffunction-sections compiler flag which is needed on parisc). Interestingly the .text sections are empty (size of 0 bytes). Since there is no need to load sections which are 0 bytes long, I don't see a reason, why such sections need to be listed under /sys/module/<module_name>/sections/<section_name> either. The attached patch does solve this issues for parisc by just don't exporting section names which are empty (size of 0 bytes). Helge
Helge, please don't send patches via bugzilla - that's a huge PITA. Email them!
Hi Andrew, I did sent it to relevant people and the parisc mailing list on Nov 27th, but missed to CC the linux kernel mailing list: http://permalink.gmane.org/gmane.linux.ports.parisc/2373 I just resent the patch to LKML (title is: [PATCH] modules: don't export section names of empty sections via sysfs) Helge
Closing - patch was applied in 2.6.32: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=35dead4235e2b67da7275b4122fed37099c2f462