All of lore.kernel.org
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: Rusty Russell <rusty@rustcorp.com.au>,
	linux-parisc@vger.kernel.org, Kyle McMartin <kyle@mcmartin.ca>,
	James Bottomley <James.Bottomley@hansenpartnership.com>,
	roland@redhat.com, dave
Subject: Re: kernel segv with 2.6.31-rc6 ?
Date: Fri, 27 Nov 2009 23:11:57 +0100	[thread overview]
Message-ID: <20091127221156.GA5334@p100.box> (raw)
In-Reply-To: <200908251707.01610.rusty@rustcorp.com.au>

* Rusty Russell <rusty@rustcorp.com.au>:
> 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@gmx.de>
CC: rusty@rustcorp.com.au
CC: James.Bottomley@HansenPartnership.com
CC: roland@redhat.com
CC: dave@hiauly1.hia.nrc.ca

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);

  reply	other threads:[~2009-11-27 22:11 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-17 21:31 kernel segv with 2.6.31-rc6 ? Helge Deller
2009-08-17 22:04 ` James Bottomley
2009-08-17 22:49 ` James Bottomley
2009-08-17 23:54   ` Roland McGrath
2009-08-18  3:18   ` Rusty Russell
2009-08-18  3:55     ` James Bottomley
2009-08-18  5:06     ` Roland McGrath
2009-08-19  0:09       ` James Bottomley
2009-08-19  0:14         ` Roland McGrath
2009-08-19  0:54           ` James Bottomley
2009-08-19  1:31             ` Roland McGrath
2009-08-19  1:38               ` James Bottomley
2009-08-19 18:10                 ` Roland McGrath
2009-08-25  7:59                 ` Rusty Russell
2009-08-25 19:24                   ` Roland McGrath
2009-08-26 12:20                     ` Rusty Russell
2009-08-26 17:54                       ` Roland McGrath
2009-08-20 11:51         ` Helge Deller
2009-08-20 11:51           ` Helge Deller
2009-08-20 12:25           ` Helge Deller
2009-08-20 12:25             ` Helge Deller
2009-08-20 18:55             ` John David Anglin
2009-08-20 21:45               ` Helge Deller
2009-08-20 21:50                 ` James Bottomley
2009-08-20 22:07                   ` Roland McGrath
2009-08-20 23:01                   ` John David Anglin
2009-08-20 23:23                     ` Roland McGrath
2009-08-21  0:03                       ` John David Anglin
2009-08-25 21:49             ` Mike Frysinger
2009-08-25  7:37         ` Rusty Russell
2009-11-27 22:11           ` Helge Deller [this message]
2009-11-30  4:41             ` Roland McGrath
2009-08-20 11:58   ` Helge Deller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091127221156.GA5334@p100.box \
    --to=deller@gmx.de \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=kyle@mcmartin.ca \
    --cc=linux-parisc@vger.kernel.org \
    --cc=roland@redhat.com \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.