[Crash-utility] crash read symbols bug

Dave Anderson anderson at redhat.com
Thu Jul 5 22:25:42 UTC 2012



 
----- Original Message -----

> > sp-1 will be NULL if sp pointer the first element in symbol
> > table, so
> > (sp-1)->value w! ill cause segment fault.
> > S! o 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 hope you could give me some advices.
> 
> Looks good to me, although I would prefer "if (sp == st->symtable)" to make
> it a bit clearer.

But wait a minute -- how did you get past the address value check at the
top of value_search_base_kernel():

  struct syment *
  value_search_base_kernel(ulong value, ulong *offset)
  {
          struct syment *sp;

======>   if (value < st->symtable[0].value)
                  return((struct syment *)NULL);

What value is in st->symtable[0].value, and what value are you passing
to the function?

Dave
 




More information about the Crash-utility mailing list