Re: [PATCH] fs/devfs/base.c

Richard Gooch (rgooch@ras.ucalgary.ca)
Sun, 3 Jun 2001 18:03:46 -0600


Linus Torvalds writes:
>
> On Sun, 27 May 2001, Richard Gooch wrote:
> >
> > I absolutely don't want this patch applied. It's bogus. It is entirely
> > safe to alloc 1 kB on the stack in this code, since it has a short and
> > well-controlled code path from syscall entry to the function.
>
> IT IS NEVER EVER SAFE TO ALLOCATE 1kB OF STACK!

I can see you care about this ;-)

> Why?
> - the kernel stack is 4kB, and _nobody_ has the right to eat up a
> noticeable portion of it. It doesn't matter if you "know" your caller
> or not: you do not know what interrupts happen during this time, and
> how much stack they want.

OK, that's a good point. Easy solution: disable interrupts in that
function.

Only kidding.

> Ergo: the simple rule of "don't allocate big structures of the
> stack" is always a good rule, and making excuses for it is bad.

OK, well, I can make the structure static instead, since the function
is single-threaded anyway.

Regards,

Richard....
Permanent: rgooch@atnf.csiro.au
Current: rgooch@ras.ucalgary.ca
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/