[Crash-utility] crash read symbols bug

chenbo lee lee.chenbo at gmail.com
Thu Jul 5 07:37:41 UTC 2012


>
>
> Dear ,
     I ported crash tool to Loongson platform which is a Mips-like CPU
developed by Institute of Computing Technology,Chinese Academic of science.
     In my work process,I found a bug in crash when run on Loongson
platform.but the bug doesn't happen in x86 platform. Funcation name
is value_search_base_kernel in symbols.c ,line 4302,version
is crash-6.0.8. code segments as follow:

       for ( ; sp < st->symend; sp++) {
                if (value == sp->value) {
                        if (offset)
                                *offset = 0;
                        return((struct syment *)sp);
                }
                if (sp->value > value) {
                        if (offset)
                                *offset = value - ((sp-1)->value);
                        return((struct syment *)(sp-1));
                }
        }

     sp-1 will be NULL if sp pointer the first element in symbol table,  so
(sp-1)->value will cause segment fault.
     So I modify the code segment as follow:
                     if (sp->value > value) {
                        if (sp - st->symtable == 0) return NULL;
                        if (offset)
                                *offset = value - ((sp-1)->value);
                         return((struct syment *)(sp-1));
                      }
     Is that OK?
      I wish you all the best.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20120705/84260549/attachment.htm>


More information about the Crash-utility mailing list