Re: kernel segv with 2.6.31-rc6 ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Rusty Russell <rusty@xxxxxxxxxxxxxxx>:
> On Wed, 19 Aug 2009 09:39:24 am James Bottomley wrote:
> > Even with the duplicate name, though, the module should be perfectly
> > loadable.
> 
> In a perfect world, yes, but there are places which assume they'll be
> unique and I always thought that reasonable.
> 
> Front of my mind is /sys/module/<MODNAME/sections/ which has one file
> per section.

I just noticed, that on parisc the duplicate sections do have a
size of "0 bytes". Objdump shows that:

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  1 .text         00000000  00000000  00000000  00000058  2**0     
                  CONTENTS, ALLOC, LOAD, READONLY, CODE            
  5 .text         00000000  00000000  00000000  000000d4  2**0       
                  CONTENTS, ALLOC, LOAD, READONLY, CODE    

> Let's figure out how it happened tho; I'd rather fail cleanly than break
> subtly and horribly later...


Since the sections are empty anyway, I don't see any reason
why those section names need to be exported via sysfs.

Let's just drop them, which works for parisc (and should for any
other architecture too).

A patch is attached to
http://bugzilla.kernel.org/show_bug.cgi?id=14703

and here:


[PATCH] modules: don't export section names of empty sections via sysfs

This patch fixes a "Badness at fs/sysfs/dir.c:487" warning on parisc, where
duplicate section names in kernel modules are common.

Signed-off-by: Helge Deller <deller@xxxxxx>
CC: rusty@xxxxxxxxxxxxxxx
CC: James.Bottomley@xxxxxxxxxxxxxxxxxxxxx
CC: roland@xxxxxxxxxx
CC: dave@xxxxxxxxxxxxxxxxxx

diff --git a/kernel/module.c b/kernel/module.c
index 8b7d880..5842a71 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1187,7 +1187,8 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect,
 
 	/* Count loaded sections and allocate structures */
 	for (i = 0; i < nsect; i++)
-		if (sechdrs[i].sh_flags & SHF_ALLOC)
+		if (sechdrs[i].sh_flags & SHF_ALLOC
+		    && sechdrs[i].sh_size)
 			nloaded++;
 	size[0] = ALIGN(sizeof(*sect_attrs)
 			+ nloaded * sizeof(sect_attrs->attrs[0]),
@@ -1207,6 +1208,8 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect,
 	for (i = 0; i < nsect; i++) {
 		if (! (sechdrs[i].sh_flags & SHF_ALLOC))
 			continue;
+		if (!sechdrs[i].sh_size)
+			continue;
 		sattr->address = sechdrs[i].sh_addr;
 		sattr->name = kstrdup(secstrings + sechdrs[i].sh_name,
 					GFP_KERNEL);
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux SoC]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux