public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: James Bottomley <James.Bottomley@steeleye.com>
Cc: Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	trivial@rustcorp.com.au
Subject: Re: [PATCH] fix for kallsyms module symbol resolution problem
Date: Tue, 01 Jul 2003 11:11:24 +1000	[thread overview]
Message-ID: <20030701040105.193BA2C221@lists.samba.org> (raw)
In-Reply-To: Your message of "30 Jun 2003 09:10:46 EST." <1056982249.2069.25.camel@mulgrave>

In message <1056982249.2069.25.camel@mulgrave> you write:
> On Mon, 2003-06-30 at 01:17, Rusty Russell wrote:
> > Yeah, but I was trying to get you to do more work.  And if the names
> > resulting are useless anyway, why apply the patch?
> 
> I noticed.
> 
> However, not printing empty names makes the trace a lot more useful. 
> Just doing a symbolic trace on modules on x86, I see pretty much the
> correct call trace now.

Right.  *That* is what I wanted to know: whether those were really
part of the backtrace or just noise.  I'll forward to Linus.

> > I think you can do it easily in module_finalize... or if we were
> > ambitious we'd extract only the function symbols rather than keeping
> > the whole strtab and symtab.
> 
> Apart from the dubious writing to a const * pointer, yes I can (it's
> what I'm doing now).  There is some annoyance in that module_finalize
> isn't told where the string or symbol tables are, so I have to find them
> again.

My mistake: add_kallsyms should be above module_finalize, which means
you can just use the mod->symtab and mod->strtab members.

How's this?

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.73-bk7/kernel/module.c tmp/kernel/module.c
--- linux-2.5.73-bk7/kernel/module.c	2003-06-15 11:30:11.000000000 +1000
+++ tmp/kernel/module.c	2003-07-01 11:09:57.000000000 +1000
@@ -1349,7 +1349,15 @@ static void add_kallsyms(struct module *
 		mod->symtab[i].st_info
 			= elf_type(&mod->symtab[i], sechdrs, secstrings, mod);
 }
-#endif
+#else
+static inline void add_kallsyms(struct module *mod,
+				Elf_Shdr *sechdrs,
+				unsigned int symindex,
+				unsigned int strindex,
+				const char *secstrings)
+{
+}
+#endif /* CONFIG_KALLSYMS */
 
 /* Allocate and load the module: note that size of section 0 is always
    zero, and we rely on this for optional sections. */
@@ -1603,14 +1611,12 @@ static struct module *load_module(void _
 	percpu_modcopy(mod->percpu, (void *)sechdrs[pcpuindex].sh_addr,
 		       sechdrs[pcpuindex].sh_size);
 
+	add_kallsyms(mod, sechdrs, symindex, strindex, secstrings);
+
 	err = module_finalize(hdr, sechdrs, mod);
 	if (err < 0)
 		goto cleanup;
 
-#ifdef CONFIG_KALLSYMS
-	add_kallsyms(mod, sechdrs, symindex, strindex, secstrings);
-#endif
-
 	mod->args = args;
 	if (obsparmindex) {
 		err = obsolete_params(mod->name, mod->args,
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

  reply	other threads:[~2003-07-01  3:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-28  3:26 [PATCH] fix for kallsyms module symbol resolution problem James Bottomley
2003-06-30  2:06 ` Rusty Russell
2003-06-30  3:13   ` James Bottomley
2003-06-30  6:17     ` Rusty Russell
2003-06-30 14:10       ` James Bottomley
2003-07-01  1:11         ` Rusty Russell [this message]
2003-07-01  2:24       ` James Bottomley
2003-07-01  4:58         ` Rusty Russell

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=20030701040105.193BA2C221@lists.samba.org \
    --to=rusty@rustcorp.com.au \
    --cc=James.Bottomley@steeleye.com \
    --cc=kai@tp1.ruhr-uni-bochum.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trivial@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox