public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 2.6.17-mm3: segvs in modpost with out-of-tree modules
@ 2006-06-28 16:51 Jeremy Fitzhardinge
  2006-06-28 18:29 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Jeremy Fitzhardinge @ 2006-06-28 16:51 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: Andrew Morton

I'm seeing SIGSEGVs in modpost when compiling the out-of-tree madwifi 
driver:

    /bin/sh: line 1: 3701 Segmentation fault scripts/mod/modpost -m -a
    -i /home/jeremy/hg/linux-2.6/Module.symvers -I
    /home/jeremy/svn/madwifi-ng/Modules.symvers -o
    /home/jeremy/svn/madwifi-ng/Modules.symvers vmlinux
    /home/jeremy/svn/madw ifi-ng/ath/ath_hal.o
    /home/jeremy/svn/madwifi-ng/ath/ath_pci.o /home/jeremy/svn/
    madwifi-ng/ath_rate/sample/ath_rate_sample.o
    /home/jeremy/svn/madwifi-ng/net8021 1/wlan.o
    /home/jeremy/svn/madwifi-ng/net80211/wlan_acl.o
    /home/jeremy/svn/madwif i-ng/net80211/wlan_ccmp.o
    /home/jeremy/svn/madwifi-ng/net80211/wlan_scan_ap.o
    /home/jeremy/svn/madwifi-ng/net80211/wlan_scan_sta.o
    /home/jeremy/svn/madwifi-ng/n et80211/wlan_tkip.o
    /home/jeremy/svn/madwifi-ng/net80211/wlan_wep.o /home/jeremy
    /svn/madwifi-ng/net80211/wlan_xauth.o

The backtrace is:

#0  0x4e8017da in strcmp () from /lib/libc.so.6
#1  0x080491a7 in export_no (s=0x0) at modpost.c:209
#2  0x0804b5c3 in read_dump (
    fname=0xbff5fa9d "/home/jeremy/svn/madwifi-ng/Modules.symvers", kernel=0)
    at modpost.c:1312
#3  0x0804b88b in main (argc=21, argv=0xbff5def4) at modpost.c:1390

I haven't really looked at yet, but I was hoping someone had already 
tracked it down.

    J

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 2.6.17-mm3: segvs in modpost with out-of-tree modules
  2006-06-28 16:51 2.6.17-mm3: segvs in modpost with out-of-tree modules Jeremy Fitzhardinge
@ 2006-06-28 18:29 ` Andrew Morton
  2006-06-28 18:44   ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2006-06-28 18:29 UTC (permalink / raw)
  To: Jeremy Fitzhardinge; +Cc: linux-kernel, Ram Pai, Sam Ravnborg

On Wed, 28 Jun 2006 09:51:11 -0700
Jeremy Fitzhardinge <jeremy@goop.org> wrote:

> I'm seeing SIGSEGVs in modpost when compiling the out-of-tree madwifi 
> driver:
> 
>     /bin/sh: line 1: 3701 Segmentation fault scripts/mod/modpost -m -a
>     -i /home/jeremy/hg/linux-2.6/Module.symvers -I
>     /home/jeremy/svn/madwifi-ng/Modules.symvers -o
>     /home/jeremy/svn/madwifi-ng/Modules.symvers vmlinux
>     /home/jeremy/svn/madw ifi-ng/ath/ath_hal.o
>     /home/jeremy/svn/madwifi-ng/ath/ath_pci.o /home/jeremy/svn/
>     madwifi-ng/ath_rate/sample/ath_rate_sample.o
>     /home/jeremy/svn/madwifi-ng/net8021 1/wlan.o
>     /home/jeremy/svn/madwifi-ng/net80211/wlan_acl.o
>     /home/jeremy/svn/madwif i-ng/net80211/wlan_ccmp.o
>     /home/jeremy/svn/madwifi-ng/net80211/wlan_scan_ap.o
>     /home/jeremy/svn/madwifi-ng/net80211/wlan_scan_sta.o
>     /home/jeremy/svn/madwifi-ng/n et80211/wlan_tkip.o
>     /home/jeremy/svn/madwifi-ng/net80211/wlan_wep.o /home/jeremy
>     /svn/madwifi-ng/net80211/wlan_xauth.o
> 
> The backtrace is:
> 
> #0  0x4e8017da in strcmp () from /lib/libc.so.6
> #1  0x080491a7 in export_no (s=0x0) at modpost.c:209
> #2  0x0804b5c3 in read_dump (
>     fname=0xbff5fa9d "/home/jeremy/svn/madwifi-ng/Modules.symvers", kernel=0)
>     at modpost.c:1312
> #3  0x0804b88b in main (argc=21, argv=0xbff5def4) at modpost.c:1390
> 
> I haven't really looked at yet, but I was hoping someone had already 
> tracked it down.
> 

Not that I'm aware of.

		if ((export = strchr(modname, '\t')) != NULL)
			*export++ = '\0';

if `export' can be NULL,

		crc = strtoul(line, &d, 16);
		if (*symname == '\0' || *modname == '\0' || *d != '\0')
			goto fail;

		if (!(mod = find_module(modname))) {
			if (is_vmlinux(modname)) {
				have_vmlinux = 1;
			}
			mod = new_module(NOFAIL(strdup(modname)));
			mod->skip = 1;
		}
		s = sym_add_exported(symname, mod, export_no(export));

that was a bad idea.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 2.6.17-mm3: segvs in modpost with out-of-tree modules
  2006-06-28 18:29 ` Andrew Morton
@ 2006-06-28 18:44   ` Jeremy Fitzhardinge
  2006-07-01  9:47     ` Sam Ravnborg
  0 siblings, 1 reply; 4+ messages in thread
From: Jeremy Fitzhardinge @ 2006-06-28 18:44 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Ram Pai, Sam Ravnborg

Andrew Morton wrote:
> On Wed, 28 Jun 2006 09:51:11 -0700
> Jeremy Fitzhardinge <jeremy@goop.org> wrote:
>   
>> I haven't really looked at yet, but I was hoping someone had already 
>> tracked it down.
>>     
>
> Not that I'm aware of.

OK, it wasn't really a bug; I had an old Modules.symvers lying around 
the madwifi tree from a previous build against an earlier kernel.  But 
modpost seems all pretty fragile...

    J

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 2.6.17-mm3: segvs in modpost with out-of-tree modules
  2006-06-28 18:44   ` Jeremy Fitzhardinge
@ 2006-07-01  9:47     ` Sam Ravnborg
  0 siblings, 0 replies; 4+ messages in thread
From: Sam Ravnborg @ 2006-07-01  9:47 UTC (permalink / raw)
  To: Jeremy Fitzhardinge; +Cc: Andrew Morton, linux-kernel, Ram Pai

On Wed, Jun 28, 2006 at 11:44:20AM -0700, Jeremy Fitzhardinge wrote:
> Andrew Morton wrote:
> >On Wed, 28 Jun 2006 09:51:11 -0700
> >Jeremy Fitzhardinge <jeremy@goop.org> wrote:
> >  
> >>I haven't really looked at yet, but I was hoping someone had already 
> >>tracked it down.
> >>    
> >
> >Not that I'm aware of.
> 
> OK, it wasn't really a bug; I had an old Modules.symvers lying around 
> the madwifi tree from a previous build against an earlier kernel.  But 
> modpost seems all pretty fragile...

I have pushed following patch that fixes the SEGV. We shoul not SEGV no
matter the input.


	Sam

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index d03c9ff..37e34d6 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -205,6 +205,8 @@ static const char *export_str(enum expor
 static enum export export_no(const char * s)
 {
 	int i;
+	if (!s)
+		return export_unknown;
 	for (i = 0; export_list[i].export != export_unknown; i++) {
 		if (strcmp(export_list[i].str, s) == 0)
 			return export_list[i].export;
@@ -1265,7 +1267,7 @@ static void write_if_changed(struct buff
 }
 
 /* parse Module.symvers file. line format:
- * 0x12345678<tab>symbol<tab>module[<tab>export]
+ * 0x12345678<tab>symbol<tab>module[[<tab>export]<tab>something]
  **/
 static void read_dump(const char *fname, unsigned int kernel)
 {
@@ -1278,7 +1280,7 @@ static void read_dump(const char *fname,
 		return;
 
 	while ((line = get_next_line(&pos, file, size))) {
-		char *symname, *modname, *d, *export;
+		char *symname, *modname, *d, *export, *end;
 		unsigned int crc;
 		struct module *mod;
 		struct symbol *s;
@@ -1291,7 +1293,8 @@ static void read_dump(const char *fname,
 		*modname++ = '\0';
 		if ((export = strchr(modname, '\t')) != NULL)
 			*export++ = '\0';
-
+		if (export && ((end = strchr(export, '\t')) != NULL))
+			*end = '\0';
 		crc = strtoul(line, &d, 16);
 		if (*symname == '\0' || *modname == '\0' || *d != '\0')
 			goto fail;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-07-01  9:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-28 16:51 2.6.17-mm3: segvs in modpost with out-of-tree modules Jeremy Fitzhardinge
2006-06-28 18:29 ` Andrew Morton
2006-06-28 18:44   ` Jeremy Fitzhardinge
2006-07-01  9:47     ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox