Re: [3.4-rc3] Thread overran stack, or stack corrupted

From: Linus Torvalds
Date: Wed Apr 18 2012 - 14:25:16 EST


On Wed, Apr 18, 2012 at 10:14 AM, Dave Jones <davej@xxxxxxxxxx> wrote:
>
> One thing I'm curious about.. Some of the function names are repeated
> for a reason that doesn't seem obvious to me, when the call chain doesn't
> call them in a loop. What's that about ?

In a "real" stack trace, it's usually due to a pointer to a function
that just gets passed around as an argument.

However, in this case, I think it's simply because you are seeing a
lot of stack-traces "on top of each other", where the callers had
slightly different stack offsets, but old stack traces "shine through"
because the stack of the newer trace is not very dense.

Gcc often generates very sparse stack frames. Sometimes it is because
of stack alignment issues, but more often it's because gcc generates
the frame for all possible local variables, and then we took an early
exit from the function (or are still in the middle of the call chain)
and part of the stack simply hasn't been modified at all.

And sometimes it is because gcc stack space allocation simply sucks.
There was a time when gcc would never share stack space between local
variables even when they had no overlap in lifetime. I know they fixed
*some* of those cases, but I suspect it's still true that gcc just
often allocates way more stack than it really needs, and then you see
old stale stack contents shine through.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/