mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Gerd Knorr <kraxel@bytesex.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RELEASE] module-init-tools 0.8
Date: Fri, 29 Nov 2002 13:38:10 +1100	[thread overview]
Message-ID: <20021129040120.6965E2C256@lists.samba.org> (raw)
In-Reply-To: Your message of "Thu, 28 Nov 2002 17:16:24 BST." <200211281616.gASGGOE6012229@bytesex.org>

In message <200211281616.gASGGOE6012229@bytesex.org> you write:
> >  Please report any bugs to rusty@rustcorp.com.au.
> 
> System (SuSE 8.1) still doesn't boot up cleanly.  After logging in as
> root I can see a number of modprobe processes hanging around in the
> process table:
> 
> bogomips root ~# ps -ax | grep modprobe
>   621 ?        S      0:00 /sbin/modprobe -- char-major-6
>   622 ?        D      0:00 /sbin/modprobe -- parport_lowlevel
>   805 ?        D      0:00 /sbin/modprobe -- autofs
>   809 ?        D      0:00 /sbin/modprobe -- autofs
>   867 ?        D      0:00 /sbin/modprobe -- autofs
>   872 ?        D      0:00 /sbin/modprobe -- net-pf-17
>  1184 ttyS0    S      0:00 grep modprobe

I suspect one of these modules is trying to load other modules in its
init routine.  I wondered if anyone did this, I guess they do 8(.

Hmm, looks like parport.  I'll send a patch to drop the module lock
around module->init().  It's a good idea *anyway*: if a module oopses
in its init routine it's nice to be able to still use modules.

> Module debugging is next to impossible right now.  The apm.o module
> oopses for me in 2.5.50.  ksymoops isn't able to translate any symbol
> located in modules.  The in-kernel symbol decoder (CONFIG_KALLSYMS)
> doesn't work too.

Please try (previously posted) patch below,
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

Name: Kallsyms inside module fix
Author: Rusty Russell
Status: Tested on 2.5.50

D: Two fixes.  Firstly, set ALLOC on the right section so we actually
D: keep the symbol names and don't deref a freed section, and secondly
D: get the symbol size (more) correct.

diff -urNp --exclude TAGS -X /home/rusty/current-dontdiff --minimal linux-2.5.50/kernel/module.c working-2.5.50-ksymoops/kernel/module.c
--- linux-2.5.50/kernel/module.c	Mon Nov 25 08:44:19 2002
+++ working-2.5.50-ksymoops/kernel/module.c	Thu Nov 28 16:22:56 2002
@@ -892,7 +892,7 @@ static struct module *load_module(void *
 		}
 #ifdef CONFIG_KALLSYMS
 		/* symbol and string tables for decoding later. */
-		if (sechdrs[i].sh_type == SHT_SYMTAB || i == hdr->e_shstrndx)
+		if (sechdrs[i].sh_type == SHT_SYMTAB || i == strindex)
 			sechdrs[i].sh_flags |= SHF_ALLOC;
 #endif
 #ifndef CONFIG_MODULE_UNLOAD
@@ -1165,7 +1165,14 @@ static const char *get_ksymbol(struct mo
 			       unsigned long *size,
 			       unsigned long *offset)
 {
-	unsigned int i, next = 0, best = 0;
+	unsigned int i, best = 0;
+	unsigned long nextval;
+
+	/* At worse, next value is at end of module */
+	if (inside_core(mod, addr))
+		nextval = (unsigned long)mod->module_core+mod->core_size;
+	else 
+		nextval = (unsigned long)mod->module_init+mod->init_size;
 
 	/* Scan for closest preceeding symbol, and next symbol. (ELF
            starts real symbols at 1). */
@@ -1177,22 +1186,14 @@ static const char *get_ksymbol(struct mo
 		    && mod->symtab[i].st_value > mod->symtab[best].st_value)
 			best = i;
 		if (mod->symtab[i].st_value > addr
-		    && mod->symtab[i].st_value < mod->symtab[next].st_value)
-			next = i;
+		    && mod->symtab[i].st_value < nextval)
+			nextval = mod->symtab[i].st_value;
 	}
 
 	if (!best)
 		return NULL;
 
-	if (!next) {
-		/* Last symbol?  It ends at the end of the module then. */
-		if (inside_core(mod, addr))
-			*size = mod->module_core+mod->core_size - (void*)addr;
-		else
-			*size = mod->module_init+mod->init_size - (void*)addr;
-	} else
-		*size = mod->symtab[next].st_value - addr;
-
+	*size = nextval - mod->symtab[best].st_value;
 	*offset = addr - mod->symtab[best].st_value;
 	return mod->strtab + mod->symtab[best].st_name;
 }

  parent reply	other threads:[~2002-11-29  3:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-28  2:28 Rusty Russell
2002-11-28 16:16 ` Gerd Knorr
2002-11-28 17:09   ` Bill Davidsen
2002-11-28 18:22     ` Tomas Szepe
2002-11-28 23:47       ` Christoph Hellwig
2002-11-28 22:49     ` Jan-Benedict Glaw
2002-11-28 18:23   ` Gerd Knorr
2002-11-28 20:52     ` Marco d'Itri
2002-11-29  3:18     ` Rusty Russell
2002-11-29  2:38   ` Rusty Russell [this message]
2002-11-29 10:00   ` Rusty Russell
     [not found] <Pine.LNX.4.44.0211272325370.924-100000@lap.molina>
2002-11-29  0:59 ` Rusty Russell
2002-11-29  1:45   ` Nathan Scott
2002-11-29  2:24     ` Thomas Molina
2002-11-29  2:50       ` Keith Owens
2002-11-29  3:41         ` Thomas Molina

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=20021129040120.6965E2C256@lists.samba.org \
    --to=rusty@rustcorp.com.au \
    --cc=kraxel@bytesex.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®