FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Crash Utility

 
 
LinkBack Thread Tools
 
Old 07-05-2012, 07:37 AM
chenbo lee
 
Default crash read symbols bug

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.
--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 07-05-2012, 10:25 PM
Dave Anderson
 
Default crash read symbols bug

----- 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


--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 

Thread Tools




All times are GMT. The time now is 10:57 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org