public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Xavier Bru <xavier.bru@bull.net>
To: linux-ia64@vger.kernel.org
Subject: 2.6.7: kallsyms --all-symbols shows a shift in the symbol addreses
Date: Mon, 21 Jun 2004 16:19:56 +0000	[thread overview]
Message-ID: <40D70AAC.2010006@bull.net> (raw)

Hi all!

There is a problem with the all kallsyms support in 2.6.7 
scripts/kallsyms.c.
Building the table reserves the adresses for all the kernel symbols in 
first step, then generates the effective addresses of the symbols in step 2.
The problem is that the symbols used to build the symbol table are not 
taken in account for the size calculation, but are included in the table 
in step 2.
This makes the table "bigger" than was allocated, and the symbols that 
come behind are shifted.
This makes kallsyms (and KDB) give wrong addresses for these symbols.

One solution is to exclude from the symbol table the symbols used for 
building it (As was provided in KDB patch :-)

--- linux-2.6.7.ori/scripts/kallsyms.c    Wed Jun 16 07:20:26 2004
+++ linux-2.6.7/scripts/kallsyms.c    Mon Jun 21 15:26:57 2004
@@ -74,6 +74,12 @@ symbol_valid(struct sym_entry *s)
 
     if (strstr(s->sym, "_compiled."))
         return 0;
+    if (!strcmp(s->sym, "kallsyms_addresses"))
+        return 0;
+    if (!strcmp(s->sym, "kallsyms_num_syms"))
+        return 0;
+    if (!strcmp(s->sym, "kallsyms_names"))
+        return 0;
 
     return 1;
 }

herafter the traces of the problem:
----------------------------------
$ grep numnode System.map
a000000100930740 G numnodes
# grep kallsyms_addresses /proc/kallsyms
a000000100894470 d kallsyms_addresses
# grep numnodes  /proc/kallsyms
a000000100930700 d numnodes

Entering kdb (current=0xa000000100724000, pid 0) on processor 0 due to 
Keyboard Entry
[0]kdb> md numnodes
0xa000000100930700 00000000 00000000 00008000 00000000   ................
0xa000000100930710 00799470 a0000001 5f757063 00007075   p.y.... cpu_up..
0xa000000100930720 00799628 a0000001 00000000 00000000   (.y.... ........
0xa000000100930730 00000003 0000000a 000015de 00000000   ........Þ.......
0xa000000100930740 00000004 00000000 00001feb 00001860   ........ë...`...
                   XXXXXXXX here it is !!!!
0xa000000100930750 00000100 00000000 0000000a 00000028   ............(...
0xa000000100930760 000001f4 00000bb8 00000002 0000003c   ô...¸.......<...
0xa000000100930770 00000000 00000032 00010000 00000eb8   ....2.......¸...
[0]kdb>

With the fix:
------------
$ grep numnodes System.map
a000000100930700 G numnodes

# grep kallsyms_addresses /proc/kallsyms
# grep numnodes  /proc/kallsyms
a000000100930700 d numnodes

Entering kdb (current=0xa000000100724000, pid 0) on processor 0 due to 
Keyboard Entry
[0]kdb> md numnodes
0xa000000100930700 00000004 00000000 00001feb 0000181f   ........ë.......
                   XXXXXXXX OK
0xa000000100930710 00000100 00000000 0000000a 00000028   ............(...
0xa000000100930720 000001f4 00000bb8 00000002 0000003c   ô...¸.......<...

-- 

 Sincères salutations.
_____________________________________________________________________
 
Xavier BRU                 BULL ISD/R&D/INTEL office:     FREC B1-422
tel : +33 (0)4 76 29 77 45                    http://www-frec.bull.fr
fax : +33 (0)4 76 29 77 70                 mailto:Xavier.Bru@bull.net
addr: BULL, 1 rue de Provence, BP 208, 38432 Echirolles Cedex, FRANCE
_____________________________________________________________________


             reply	other threads:[~2004-06-21 16:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-21 16:19 Xavier Bru [this message]
2004-06-21 16:29 ` 2.6.7: kallsyms --all-symbols shows a shift in the symbol Randy.Dunlap
2004-06-21 22:18 ` 2.6.7: kallsyms --all-symbols shows a shift in the symbol addreses Keith Owens

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=40D70AAC.2010006@bull.net \
    --to=xavier.bru@bull.net \
    --cc=linux-ia64@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