Re: Detailed Stack Information Patch [0/3]

From: JÃrn Engel
Date: Tue Mar 31 2009 - 15:02:38 EST


On Tue, 31 March 2009 20:22:15 +0200, Stefani Seibold wrote:
> Am Dienstag, den 31.03.2009, 17:49 +0200 schrieb Andi Kleen:
> > Stefani Seibold <stefani@xxxxxxxxxxx> writes:
>
> > > - Misuse the thread stack for big temporary data buffers
> >
> > That would be better checked for at compile time
> > (except for alloca, but that is quite rare)
>
> Fine but it did not work for functions like:
>
> void foo(int n)
> {
> char buf[n*1024];
>
> }
>
> This is valid with gcc.

Good call. checkstack should look for those as well. It is certainly
possible to detect statically and warn about:

10: 29 c4 sub %eax,%esp

Runaway recursions are a different matter, though. The code I once had
to detect them depends on an old version of smatch, which in turn
depends on gcc 3.1. And even assuming this was in a reasonable shape, I
still don't know what to do about it. The kernel has thousands of
recursions and trying to work out how deep each one may stack is a
never-ending project.

JÃrn

--
A quarrel is quickly settled when deserted by one party; there is
no battle unless there be two.
-- Seneca
--
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/