Bug 14703 - parisc: Badness at fs/sysfs/dir.c:487
Summary: parisc: Badness at fs/sysfs/dir.c:487
Status: RESOLVED CODE_FIX
Alias: None
Product: Other
Classification: Unclassified
Component: Modules (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: other_modules
URL: http://patchwork.kernel.org/patch/42190/
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-27 21:59 UTC by Helge Deller
Modified: 2009-12-03 21:28 UTC (History)
5 users (show)

See Also:
Kernel Version: 2.6.32-rc8
Tree: Mainline
Regression: Yes


Attachments
[PATCH] modules: don't export section names of empty sections via sysfs (1.18 KB, patch)
2009-11-27 21:59 UTC, Helge Deller
Details | Diff

Description Helge Deller 2009-11-27 21:59:03 UTC
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
Comment 1 Andrew Morton 2009-12-01 23:40:08 UTC
Helge, please don't send patches via bugzilla - that's a huge PITA.

Email them!
Comment 2 Helge Deller 2009-12-02 23:33:50 UTC
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

Note You need to log in before you can comment on or make changes to this bug.