This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Detect infinite backtraces


On Tue, 21 Jan 2014 17:04:32 +0100, Mark Wielaard wrote:
> Sorry I thought that was obvious. It disables consistency checking
> completely when a magic symbol can be found.

As on the real world supported platforms this magic symbol is the only way
when ebl-defined arch frames ordering can be violated.


> That IMHO is two wrongs.
> First it shows there is something wrong with the consistency checking
> because it checks something that isn't always actually wrong. Secondly
> it introduces symbol lookups in the middle of an frame unwind, making it
> depend on symbol resolution which looks like a layering violation.

It may be violating some abstract layers but it just works.


> > > Yes, given that you don't have a defined ordering for the CFA values.
> > 
> > arch/ebl can define it.
> 
> It might be able to define something like a frame identity depending on
> arch specific registers in a frame. So you could use that to
> compare/detect previously seen frames. But I don't immediately see how
> you can define an ordering. What do you suggest to use as ordering
> function?

For all supported archs obviously: ($sp0 < $sp1) <=> $sp0 is inner to $sp1


> > > You could check all previous frames to check for duplicate values. But
> > > that seems wasteful given that backtraces can be pretty deep.
> > 
> > There is dynamicsizehash.[ch] which can handle it fast enough.
> 
> OK, but it might still take up a lot of memory.

When the backtrace is long then dynamicsizehash will be equally also long.

Stack is normally 8MB so dynamicsizehash can be also approx. say 20MB.
If it was for example >200MB in the overflown stack case then one may think
about it a bit but does 20MB mean anything worth a word?


> Although I guess you could restrict it to just the last few frames.

This again makes this feature working only sometimes, that is useless for
low-level tools upon which other high-level functionality depends.


To make a summary what can remain from this patch to get it accepted:
 * "__morestack" check is forbidden
 * frames ordering by $sp0 < $sp1 is forbidden
 * dynamicsizehash.[ch] is forbidden
 * only $sp0 == $sp1 can be checked and >= 2 frames loops are not detected
 * therefore signal frames / sigaltstack makes no difference for this patch
 * CFA check is forbidden, it should check real ebl-supplied SP


Jan

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]