2.6.7: kallsyms --all-symbols shows a shift in the symbol addreses

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 at bull.net
addr: BULL, 1 rue de Provence, BP 208, 38432 Echirolles Cedex, FRANCE
_____________________________________________________________________


---------------------------
Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe.


[Index of Archives]     [Linux Kernel Development]     [Linux Kernel Newbies]     [Linux USB Development]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux